The men of Moroccan origin, aged 32 and 42, were arrested in Barcelona, the ministry said in a statement without specifying the date.
They are suspected of having used "different virtual platforms and social media to spread the extremist ideals of Daech (Arab acronym for the ISIS group) and attract followers to send them to the conflict zones," the statement said.
According to the Vanguardia newspaper, the two men were arrested at a street close to the Sagrada Familia church near the centre of the city, by Madrid-based officers of the national Guardia Civil police working together with colleagues from Barcelona.
A 24-year-old Spanish woman was arrested in a town northeast of Barcelona who had been radicalised and was ready to leave to join the extremist groups, said the ministry. According to Vanguardia, she was planning to travel to Afghanistan.
Spain has been under a high security alert -- level 4 out of 5 -- since June and has arrested some 95 people in its investigation of suspected jihadist cells since the start of the year.
The ministry estimates that around 139 people have left Spain to fight in Syria or Iraq and only 25 have returned.
In comparison, French authorities say at least 250 jihadist fighters have returned to France.