The two men were detained in a morning raid in the city of Cornella de Llobregat just outside Barcelona suspected of "maintaining contact with people in conflict zones, offering their support and encouraging them to continue their activities," the interior ministry said in a statement on Wednesday.
"They also allegedly actively and directly participated in Daesh (IS)'s propaganda machine, by organising private meetings to watch propaganda content produced by the terrorist organisation," it added.
The ministry said the two men - a Moroccan national and a Spanish citizen - aimed to persuade those who watched the videos or photos to join Isis and go to conflict zones.
The arrests come just a day after authorities held three men who allegedly aimed to carry out an attack in the Spanish capital.
Interior Minister Jorge Fernandez Diaz told Cadena Ser radio that the suspects "were ready to conduct indiscriminate attacks", including knife attacks like those recently conducted by Palestinian militants in Israel or deadly assaults with rifles.
Like other European nations, Spain has been grappling with a growing number of jihadist cells on its territory and radicalised Muslims leaving to fight for IS or other Islamist groups in Iraq and Syria.
More than 100 people from Spain are suspected of having joined jihadist fighters in Iraq and Syria and authorities fear they may return to launch attacks.
Some 171 suspected jihadists have been detained in Spain since December 2011, according to the interior minister, most of them accused of recruiting for IS rather than actually planning attacks themselves.
Spain raised its terror alert to four on a scale of five on June 26th following deadly attacks in France, Tunisia and Kuwait.
It is the highest alert level since Al-Qaeda-inspired bombers blew up four packed commuter trains and killed 191 people in Madrid on March 11th, 2004.