The expulsions were confirmed the day after NATO formally invited Macedonia to join the western military alliance pending the agreement's successful completion. Moscow opposes any expansion of NATO, particularly if it involves nations Russia sees as within its natural sphere of influence.
Greek Prime Minister Alexis Tsipras told Greek reporters in Brussels after a NATO summit ended Thursday that he was obliged "to defend the national sovereignty" of Greece, but did not refer to Russia or the expulsions directly.
"We seek good relations with most countries - not only the ones in our neighborhood," Tsipras said. "But we do demand that all countries respect our international legitimacy and national sovereignty."
Russian authorities have been given until Friday to get the two diplomats out of Greece, the Greek official told The Associated Press. He asked not to be identified, citing the sensitivity of the issue.
The government was compelled to act after receiving evidence of "specific actions," the official said. Greece also blocked other Russian officials from entering the country, he said.
It was not clear if the Russian diplomats have departed or are preparing to leave.
The United States welcomed the Greek action. In a message posted on Twitter, U.S. State Department spokeswoman Heather Nauert said: "We support Greece defending its sovereignty. Russia must end its destabilizing behavior."
The deal to end the name dispute foresees Macedonia renamed as North Macedonia in exchange for Greece dropping objections to its northern neighbor joining NATO and the European Union.
A Russian diplomat who spoke on condition of anonymity because he was not authorized to speak publicly dismissed as "nonsense" allegations that Russian diplomats were involved in undermining Greek public support for the Macedonia deal.
In Moscow, the Foreign Ministry took a careful stance.
Ministry spokeswoman Maria Zakharova warned that diplomatic expulsions typically bring a tit-for-tat response, but underlined the importance of Russia-Greece ties.
The agreement between Greece and its small northern neighbor still faces several hurdles - including constitutional changes and a referendum in Macedonia - before it becomes final.
Protests against the agreement have been held in both countries, backed by the political opposition.
Igor Pshenichnikov, an expert at the Russian Institute for Strategic Studies, a government-funded think-tank, alleged the Greek authorities acted "under the pressure of their advisers from Brussels and Washington."
In remarks carried by the Tass news agency, he described the move as Greek Prime Minister Alexis Tsipras' "gift for the NATO summit."
Russia has tried to prevent some countries from joining NATO, including historic Slavic ally Montenegro. The Balkan country became NATO's 29th member a year ago.
Menelaos Hadjicostis reported from Nicosia, Cyprus. Vladimir Isachenkov in Moscow and Derek Gatopoulos in Athens contributed to this report.
Follow Kantouris at http://twitter.com/CostasKantouris and Hadjicostis at http://twitter.com/menhad
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.