"The national police at dawn this morning carried out an anti-terrorist operation which led to the detention in Ceuta of two suspected jihadists," the interior ministry said in a statement.
"They were part of a cell that was fully prepared and willing to carry out an attack on national territory," it said.
The police operation was linked to four other arrests in Ceuta on January 24, when officers detained two sets of Spanish brothers of Moroccan origin.
The statement said the two latest suspects were thought to be members of the same cell as the other four.
A coastal city fenced off from northern Morocco, Ceuta has one of Europe's only two land borders with Africa, along with another Spanish territory, Melilla, to the east.
Spain's government has announced raids on a series of suspected Islamist cells over recent months, most of them in Ceuta and Melilla.
It says about 100 people from Spain are suspected of having joined jihadist fighters in Iraq and Syria and fears they may return to launch attacks.
