High Court Judge Javier Gomez Bermudez in Madrid ruled that there was a "high probability" that Mohamed Said Mohamed was the head of the cell based in Melilla, a Spanish territory on the northern tip of Morocco, and the nearby Moroccan city of Nador.
Spanish and Moroccan security forces detained Mohamed, a Spanish national of Moroccan descent, and eight other suspected members of the cell on Friday in Melilla and Nador.
Spain's interior ministry said at the time that Mohamed worked with his brother, a former Spanish soldier and explosives specialist who is currently fighting with Isis militants now in control of large swathes of Iraq and Syria.
Two of the suspected members of the cell are believed to have travelled in July to an area of Syria or Iraq under IS control, the ministry added.
The judge said in his ruling that there was evidence that the suspects were planning their "imminent" departure to join the Isis jihadists.
He said Mohamed had made contradictory statements during questioning, such as claiming not to know the other suspects who were detained on Friday even though witnesses had seen him meeting with them.
Moroccan authorities estimate there are between 1,500 and 2,000 Moroccans fighting in Syria and Iraq. Spain has arrested dozens of suspected extremists in raids this year.
IS fighters have beheaded a British aid worker and two US journalists, and are holding two other Britons, Alan Henning and John Cantlie.
A US-led alliance has launched air strikes against the IS militants in Syria and Iraq.
Spain has spoken out against the brutality of Isis but it has not participated in military strikes against the militants in Iraq or Syria.