The arrests took place in Fez, Tétouan and Fnideq (Castillejos), not far from North African Spanish enclave of Ceuta, after extensive investigations involving Spanish security agents.
Some of those detained had 'strong ties' to Spain, Spain's Interior Ministry said in a statement.
The cell is believed to have been dedicated to the recruitment, financial support and deployment of jihadists. Moroccans and others recruited to the cause by the group would be sent to training camps in Siria and Iraq run by the terrorist organization ISIS.
Once there, they would learn how to use firearms, build and defuse bombs, steal cars and other skills needed to carry out terrorist attacks or suicide missions.
Some of those recruited by the men arrested are believed to have participated in acts of violence in Syria and Iraq, including decapitations which were filmed and shared on social media.
Moroccan police, who made the arrests, called upon the assistance of Spain's intelligence services and police to help bring down the group.
The arrest comes just after a 14-year-old Spanish girl was arrested for joining a terrorist organization, after making contact with the group via social media.
She is currently serving six months in a juvenile detention centre where she is not allowed to wear a full face veil and has no access to the Internet.
Spain is one of Europe's biggest terrorism hubs, according to Europol, and its security services are experienced in gathering data and combating terrorist networks.
In 2013, Spain was the EU country in which the highest number of court proceedings for terrorist offences were concluded. Despite a slight dip in numbers, Spain also remains the country with the highest percentage of guilty verdicts for people on terrorism charges.