One suspect was detained in Spain while the other 13 were arrested in cities across Morocco, a Spanish interior ministry statement said, describing it as a "joint anti-terrorist operation".
"Those arrested formed part of a network whose main activity was torecruit and send foreign fighters to join the ranks of the terrorist organisation Daesh in regions of Syria and Iraq under its control," it said, using the main Arabic acronym for the group.
The Spanish suspect was arrested in San Martin de la Vega, 30 kilometres (20 miles) south of Madrid, while the others were picked up in the Moroccan cities of Fez, Casablanca, Nador, Al Hoceima and Driouech.
"They wanted to replicate in Morocco and Spain the massacres carried out by Daesh members with the aim of creating a climate of fear and instability," it added.
The arrests come as Europe was on high alert after passengers on a crowded Paris-bound train tackled and disarmed a heavily-armed Moroccan man with guns and a box cutter on Friday, halting what authorities say could have been a bloodbath.
The alleged attacker, 25-year-old Ayoub El Khazzani, had lived in Spain for seven years until 2014, when he moved to France.
Tuesday's arrest of the suspect near Madrid raised to 48 the total number of people detained in Spain this year as part of jihadist-related investigations in Spain, Interior Minister Jorge Fernandez Diaz told reporters. The total number for 2014 was 36.
"All nations are threatened. We have already said this is not a religious war but a war waged by barbarians against all who oppose their absolutely fanatical vision of Islam which has nothing to do with authentic Islam," he said.
These "preventative operations" demonstrate the "importance of the security partnership" between Spain and Morocco, the Moroccan interior ministry said in a statement.
Europe has been grappling with a growing number of jihadist cells and radicalised Muslims leaving to fight for the Islamic State or joining the rebels in Iraq and Syria.
France has the highest overall numbers of people joining the jihad, with the government reporting that 843 had left for Syria as of May -- more than half of them unknown to authorities at the time of their departure.