Morocco's interior ministry said one of the jihadist suspects was arrested in the northern Moroccan port of Tangier, and the other two were detained in Spain.
The ministry said the three-man cell had been in “close contact” with IS in Iraq and Syria and was recruiting volunteers to join the jihadist ranks.
The arrests were made in Badalona and Salou, towns in Catalonia, with a third man arrested in Tangier, said Spain's interior ministry added in a statement.
Both Morocco and Spain have been spared in the wave of recent IS attacks that have targeted Paris, Brussels and Berlin, as Rabat and Madrid collaborate closely in the fight against extremism.
However, Spain was hit in 2004 by the deadliest Islamist attack on European soil, when 191 people were killed in bombings on commuter trains in Madrid.
And Morocco was targeted in 2003 and 2011 in attacks on the cities of Casablanca and Marrakesh, with 45 and 17 fatalities respectively.
On April 28, two suspected jihadists arrested in Spain admitted being in Brussels airport at the time of the March 2016 attack there that killed 32, but denied involvement.
The two suspects were among a group of nine people taken in for questioning in Barcelona and the northeastern region of Catalonia.
At the time of the arrests in Spain, searches were carried out in Morocco by police accompanied by their Spanish counterparts.