The National Court in Madrid said the suspects were part of an international network "dedicated to radicalizing, recruiting and sending mujahideen to Syria to wage jihad and become martyrs".
It suspects them of belonging to a terrorist organization with links in Morocco, Belgium, Turkey and Syria that it said sent Spanish and Moroccan nationals to Syria.
The court said in a written ruling that at least five of those sent by the group to Syria had died there carrying out suicide attacks.
Among the suspects the court named Karim Abdeselam Mohamed, 39, as the leader of the network.
The written ruling ordered that he be held in custody, while judicial officials separately told news agency AFP the seven others were also ordered to be held, with one of them also facing arms charges.
Spanish security forces arrested the eight on Friday in raids in Ceuta, a Spanish territory in north Africa, and in the nearby town of Fnideq across the border in Morocco, the Spanish interior ministry said.
It said the network operated in the two towns and sent dozens of Islamist militants — some minors — to Syria.
European Union governments are showing growing alarm over the security threat posed by hundreds of young Europeans believed to be fighting alongside rebels in Syria.