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 Islamic State group) and attract followers to send them to the conflict zones," the statement said.
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, which declined to name what country she was heading for.
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.