Russia responded by expelling two Spanish diplomats last week, a Spanish foreign ministry spokesman said.
The spokesman would not comment on reports the Russians had engaged in economic espionage.
The spat comes before a year of high-profile cultural exchanges between the two countries.
Russia is due to celebrate a “Year of Spain” while Spain is to have a “Year of Russia”.
Spain’s respected newspaper El Pais said the Spanish government had not publicised its expulsions last month because it did not want to spoil the forthcoming events.
The Spanish foreign ministry spokesman said the two Russians had been expelled “for activities incompatible with their status as diplomats” – the diplomatic term for spying.
Both governments considered the incident “resolved” and were working to replace the diplomats, he added.
According to El Pais, political attache Ignacio Cartagena and first secretary Borja Cortes-Breton were expelled from Moscow on Friday.
Mr Cartagena has been involved in planning the “Year of Spain” programme in Russia.
It is the most serious diplomatic incident between the two countries since Moscow restored diplomatic relations with Madrid in 1977, following the death of veteran right-wing dictator Francisco Franco, El Pais notes.
But a scheduled visit to Moscow by Spanish Foreign Minister Trinidad Jimenez is due to go ahead on 17 January.
Earlier in December, the UK expelled a Russian diplomat, and Russia responded in kind.
It is not clear what the alleged spying in that case involved – BBC