The arrest occurred in the Spanish city of Figueres, North-Eastern Catalonia, the Moroccan news agency MAP reports citing the Spanish interior ministry.
The arrest was made possible thanks to coordination between Spain and the Netherlands, and cooperation with intelligence services of several other countries, the interior ministry further noted.
The man is suspected to be member of the terrorist group by Dutch authorities who have also issued an international arrest warrant against him.
The coordination between services “was fluid” over the past days after it turned out that the suspect returned to Spain after a sojourn in Turkey; a transit-road into Syria, the interior ministry noted.
Investigations are still ongoing to determine his level of radicalism, his connections in Europe, his mission as well as his objectives since his return to Spain.
Spanish security forces also on Friday netted two IS sympathizers of Moroccan nationality in the Spanish occupied enclave of Ceuta. The men had gone through a long radicalization process and were poised to stage attacks in the city, Spanish La Guardia civil said.
Investigators discovered at their residences semi-automatic guns, ammunitions, swords and knives, report say.
Up to 181 terrorist suspects have been arrested since 2015 in Spain.