Officers detained the suspects in six regions across Spain after they returned from predominantly Russian-speaking eastern Ukraine, the interior ministry said in a statement.
They had gone to Ukraine last year where they joined pro-Russian groups fighting for independence in the Luhansk and Donetsk regions, the statement added.
The Spaniards belonged to the far-left and were inspired by the International Brigades, the multinational volunteer forces that fought against Francisco Franco's uprising during the Spanish Civil War in the 1930s.
"Their activities can be considered offences that compromise Spain's peace or independence, as Spaniards who, while taking part in an armed conflict, violate the neutrality Spain must keep in relation to the international community," the statement said.
Also Read
The interior ministry said it was the first operation in Europe directed against foreign fighters in Ukraine
Pro-Russian forces in the eastern Ukraine are battling those of the Ukrainian government, which is backed by the West.
The conflict has killed at least 5,800 people since April and it has dragged ties between Russia and the West to their lowest since the Cold War.
A large number come from Russia and former Soviet states, but many have come from Israel, Serbia, Spain, Italy and Brazil.
"These arrests sadden me," a leader of Ukraine's pro-Russian separatist rebels, in Donetsk, Denis Pouchiline, told AFP.
"I think we are going to demand explanations from Spain over this incident, there are many volunteers in our ranks, the greatest number come from Russia, but there are representatives from Spain, Italy, France... It is the first time that they have these types of problems."
In one web post dated August 2014, a Spanish left-wing group, invoking the example of the International Brigades, called on supporters to go to eastern Ukraine to fight against "the cancer of fascism" that it said was spreading in Ukraine.