File photo: Delil Souleiman/AFP
The 29-year-old, born in Syria, was arrested Friday in Malaga in southern Spain, suspected of having fought in the ranks of Isis for at least two years in Syria, said the Spanish interior ministry.
Officials are searching seized equipment in order to shed light on the man's intentions and find out who he has been in contact with, the ministry also said.
The arrest was overseen by officials from the anti-terrorist section of the country's highest court.
Security is tight across the country, as Saturday's march in Madrid for gay, lesbian, bisexual and transgender rights is expected to draw crowds that could reach two million people.
Three Moroccans were arrested in the capital in June, including one suspected of belonging to IS and studying terrorist manuals.
No references to WorldPride were found in documents and hard drives searched following those arrests, operations chief for Madrid police German Castineira had said on Thursday.
“There is no specific terrorist threat but a generalised threat,” he said.
Spain is on high alert for terrorism — level four out of five — but has been spared the type of attacks seen in London, Paris, Brussels and Berlin in recent years.
In 2004, 191 people died after bombs exploded on commuter trains in Madrid in an attack claimed by Qaeda-inspired militants.