MOSCOW — In a head-spinning turn of events on Friday, President Vladimir Putin of Russia announced that he would not retaliate against the United States' decision to expel Russian diplomats and impose new sanctions — hours after his foreign minister recommended doing just that.

Putin, betting on improved relations with the next American president, said he would not eject 35 diplomats or close any diplomatic facilities, rejecting a response to actions taken by the Obama administration on Thursday.

The switch was remarkable, given that the foreign minister, Sergey Lavrov, had just recommended the retaliation in remarks broadcast live on national television, and given the long history of reciprocal expulsions between the two countries. Russian officials have traditionally been sticklers for diplomatic protocol.

"While we reserve the right to take reciprocal measures, we're not going to downgrade ourselves to the level of irresponsible 'kitchen' diplomacy," Putin said, using a common Russian idiom for quarrelsome and unseemly acts. "In our future steps on the way toward the restoration of Russia-United States relations, we will proceed from the policy pursued by the administration of D. Trump."

Should Putin have chosen to retaliate harshly against the United States, he would most likely have deepened the rift between the two countries and left President-elect Donald Trump with a nettlesome diplomatic standoff from the moment he arrived in the Oval Office. But by choosing to essentially disregard President Barack Obama's punitive measures, Putin can try to disarm his U.S. critics, including members of Congress who consider him an aggressive foe of the United States. That could give Trump more room to pursue the closer cooperation with Russia that he has advocated.

Putin has a flair for smart, unexpected tactics, and his announcement on Friday appeared to be in keeping with that. Despite all the statements from senior officials, including one from Lavrov, about the need to respect "reciprocity," Putin essentially warned Washington that he was waiting for the Trump administration — a tactic not unlike that adopted by Israel in its recent rejection of a peace plan laid out by Secretary of State John Kerry.

"This is a perfect step because it makes Obama's administration look very weak and it opens a new page in relations with Trump," said Vladimir Frolov, an international affairs analyst and a columnist. "Moscow wanted Trump to have a room to maneuver, this decision is a clear gesture of goodwill toward him."

In a statement issued by his transition office late Thursday, Trump was noncommittal, saying, "It's time for our country to move on to bigger and better things."

Putin called it "unfortunate" that the Obama administration chose to end its relationship with Russia in such a way, but sent New Year's greetings to Obama, his family, Trump, and "all the American people."

Just hours earlier, Lavrov had recommended that 31 U.S. diplomats be expelled from Moscow and four from St. Petersburg. He also recommended the closing of two facilities: a wooded picnic area on a Moscow River island used by diplomats, as well as a warehouse in the southern, industrial part of the Russian capital.

"Of course, we cannot leave such mischievous tricks without a response," he said. "Reciprocity is the law of diplomacy and of international relations."

Putin said he did not want to deprive the diplomats' children of access to the recreational area on the island. He went one step further, inviting all children of U.S. diplomats accredited in Russia to celebrate the New Year and the Russian Orthodox Christmas with him at the Kremlin.

For decades, the Kremlin has held a series of parties for children in December and January. Tickets start around $82 and can be bought online — but they are usually limited to Russian children.

On Thursday, the Obama administration moved to eject 35 Russians suspected of being intelligence operatives "persona non grata"; imposed sanctions on two of Russia's leading intelligence services; and penalized four top officers of one of those services, the powerful military intelligence unit known as the GRU, because of its efforts to influence the presidential election.

As part of the punishment, the State Department said that it would close two waterfront estates — one in New York, the other in Maryland — that it said were used for Russian intelligence activities.

The actions amounted to the strongest U.S. response yet to a state-sponsored cyberattack.

U.S. intelligence agencies have concluded that the GRU, with the approval of the Kremlin, ordered the attacks on the Democratic National Committee and other political organizations, and that the Russian government enabled the publication of the emails it obtained to benefit Trump's presidential campaign.

In addition to giving the diplomats and their families 72 hours to leave the country, the measures announced by Obama imposed sanctions on Russia's two main intelligence services. Washington described the diplomats as intelligence agents working under the cover of diplomacy.

Previous sanctions by the United States and its Western allies were levied against broad sectors of the Russian economy and also blacklisted dozens of individuals, some of them close friends of Putin's who were considered crucial in the annexation of Crimea in 2014 and in destabilizing Ukraine.