Russian Prime Minister Dmitry Medvedev says he is sad to see the Obama administration end on an anti-Russia footing as President Vladimir Putin ditched plans to expel American diplomats.

On Friday Putin backtracked on a decision to kick out 35 American embassy and consular officials just hours after the plan was announced by Russian Foreign Minister Sergey Lavrov.

"We will not create problems for American diplomats. We will not send anyone away," Putin said in a Kremlin press release according to Russian state news service TASS.

Putin then invited the children of American diplomats in Russia to join him for New Year celebrations around the Christmas tree in the Kremlin.

The Russian leader said that while "reserving the right to retaliate," Russia would not "stoop to the level of ... irresponsible diplomacy" and would attempt to rebuild Russian-American relations through policy shaped with the administration of President-elect Donald Trump.

Medvedev tweeted earlier on Friday (30 December): "It's sad that Obama administration, which began life by restoring ties (with Russia) ends with anti-Russian death throes. RIP."

On Thursday President Barack Obama expelled 35 Russian diplomats from the US, closed two Russian diplomatic retreats, and introduced sanctions that affect the highest levels of Russian leadership and intelligence agencies.

Obama's move came in response to American intelligence agency conclusions that Russia hacked US political parties to influence the 2016 presidential election.

Reacting from Moscow, presidential press secretary Dmitry Peskov called Obama's decision a "display of aggression". He said Russia would respond on Friday.

Early on Friday, Russian Foreign Minister Sergey Lavrov said 31 diplomats at the US Embassy in Moscow, and four at the American Consulate General in St. Petersburg, have been ordered to leave the country. Lavrov said the US was also being blocked from using a diplomatic retreat in "Serebryany Bor and warehouse on Road Street". In his statement Putin did not touch on whether sanctions on the retreat and warehouse would remain.

"Of course, we cannot leave these tricks unanswered, reciprocity - it is the law of diplomacy and international relations," Lavrov said at the time. But the plan was quickly reversed by Putin just hours later.

"The new unfriendly steps of the outgoing US administration are seen as a provocation aimed at further undermining US-Russian relations," Putin said, adding that the US and Russia have a "special responsibility" to preserve global security.

Kremlin spokesman Peskov had said Thursday that Russia would respond "adequately" to the US and this would "be determined in line with decisions adopted by Russian President."

Russia's first tit for tat move was reportedly to close the Anglo-American School of Moscow attended by the American, Canadian and British embassies and attended by 1,250 students from about 60 countries. The students are currently on holiday.

Prominent members of the Republican party have united behind Obama's new sanctions against Russia and are calling for them to be strengthened in the next Congress starting 3 January. President-elect Donald Trump who has rejected claims that Russia was behind cyberattacks targeting American political parties has said he will meet with American intelligence agencies next week "to be updated on the facts of this situation".

Russia, however, still hopes to mend relations under the Trump administration. "We still expect that we would be able to deal with the fallout from such clumsy moves and that sooner or later, through joint steps, we will take the path of normalising our bilateral relations," said Peskov.

Note: This article was updated to include comments from President Putin.