The 32-year-old had a large collection of extreme Islamist material, including a manual for suicide bombers, the government said.
The dawn raid on Tuesday saw two other Moroccan men arrested.
The unnamed 38 and 33-year-olds both lived with the first man in the residential apartment, according to the Interior Ministry.
The first man had been training them to join ISIS.
Footage of the arrest showed armed police in riot gear storming the apartment building before dawn and men dressed in white robes and motorcycle helmets being grappled to the ground and handcuffed outside the apartment block.
The man had an extremely dangerous profile, similar to that of those who carried out recent attacks in Britain and France, the government said, without giving further details.
- REVEALED: What’s really behind the surge in ‘narco terrorism’ on Spain’s Costa del Sol as record €100 million cash and 40 tonnes of drugs seized - 12 Dec, 2018 @ 15:36
- COLD FRONT: Yellow weather warning for strong winds in Malaga TOMORROW while snow predicted across Spain - 12 Dec, 2018 @ 12:30
- PEED OFF: Dog walkers on Costa del Sol to be FINED for not cleaning up pet’s urine in new crackdown - 12 Dec, 2018 @ 11:55
- WARNING: Police in Spain ramping up roadside alcohol and drug checkpoints THIS WEEK - 10 Dec, 2018 @ 18:02
- WATCH: Truck DESTROYS archway entry of urbanisation on Spain’s Costa del Sol - 10 Dec, 2018 @ 16:23
- SHAMEFUL: Spain loses €90 BILLION per year due to corruption while UK among LEAST corrupt in EU, study reveals - 10 Dec, 2018 @ 14:59
- Leading Irish Kinahan mafia member falls to death from Marbella hotel in ‘accident’ - 9 Dec, 2018 @ 16:08
- Spain’s Mallorca must ‘turn away from British market’ to survive no-deal Brexit, business leaders warn - 7 Dec, 2018 @ 13:40
- Bullfighting ‘returning to Marbella’ despite being BANNED three years ago - 6 Dec, 2018 @ 17:25
- Rise of the right in Spain’s Andalucia could make life for British expats more difficult, expert warns - 3 Dec, 2018 @ 16:16