Officers "today detained two suspected terrorists of Al-Qaeda in Murcia and Zaragoza," with help from the French and Moroccan police, the ministry said.
One man of Algerian origin, Nou Mediouni, was arrested in the northern city of Zaragoza and one of Moroccan origin, Hassan El Jaaouani, in the southeastern region of Murcia.
The ministry said they were "suspected members of a radical cell related to the terrorist organisation AQIM (Al-Qaeda in the Islamic Maghreb)".
The north African branch of the late Osama Bin Laden's global extremist network, AQIM has carried out attacks and kidnappings across the region.
The statement did not elaborate on the arrests but said it would give more details later.
A judicial source who asked not to be named said the two were considered to have recently become radicalized and had consulted jihadist Internet sites.
The source said the two would go before a judge at the National Court in Madrid on Thursday.
Several suspected Islamic extremists have been arrested in recent years in Spain.
Police in Valencia in February arrested a 22-year-old Moroccan, Mohamed Echaabi, for allegedly plotting terrorist attacks in Spain and elsewhere in Europe.
In March 2012, police in Valencia arrested Mudhar Hussein Almalki, a Saudi suspected of running jihadist Internet forums and sharing documents with extremists.
In August, Spanish authorities said they arrested two Chechens and a Turk, suspected Al-Qaeda members thought to have been planning an attack in Spain or elsewhere in Europe.
On March 11, 2004, Spain suffered one of Europe's worst extremist attacks.
Explosions on packed commuter trains in Madrid killed 191 people in bombings linked to Al-Qaeda.