Those arrested repeatedly made comments on social network profiles with large numbers of followers that ranged from "glorifying the terrorist organisations and the murders they carried out, to mocking the victims of terrorism", the ministry said in a statement.
The groups praised the armed Basque separatist group ETA, Catalonia's nationalist Terre Lliure or Free Land group and the shadowy far-left group GRAPO. None has carried out armed actions in recent years.
The arrests were carried out in seven of Spain's 17 regions, the ministry said, adding that the operation remained open and there could be more arrests.
ETA in 2011 declared an end to its armed activity after four decades of bombings and shootings that left 829 people dead in a campaign for an independent Basque homeland in northern Spain and southwestern France but it has yet to formally disband or disarm.
GRAPO, which stands for First of October Anti-Fascist Resistance Group, has been relatively inactive since it was broken up in France and Spain in 2000 and 2002.
It was founded in 1975 a few months before the death of Spanish dictator Francisco Franco and has been blamed for the murders of more than 80 Spanish police and soldiers.