In a head-spinning turn of events on Friday, President Vladimir V. Putin of Russia announced that he would not retaliate against the United States’ expulsion of Russian diplomats and new sanctions — hours after his foreign minister recommended doing just that.
Mr. Putin, apparently betting on improved relations with the next American president, said he would not eject 35 diplomats or close any diplomatic facilities, a proposed tit-for-tat response to actions taken by the Obama administration a day earlier.
In an announcement on the Kremlin’s website, Mr. Putin said he did not want to deprive children of access to a recreational area on an island in the Moscow River that his foreign minister had recommended closing. He went one step further, inviting all children of American diplomats accredited in Russia to celebrate the New Year and the Russian Orthodox Christmas with him at the Kremlin. (Their parents are presumably welcome; no date was announced.)
The switch was remarkable, given that the foreign minister, Sergey V. Lavrov, had just made the recommendation in remarks broadcast live nationwide, and given the long history of tit-for-tat expulsions between the two countries. Both the Soviet Union and the Russian Federation have traditionally been sticklers for diplomatic protocol.
On Thursday, the Obama administration declared 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 G.R.U., 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. It was not clear, however, whether the two properties were a base for the election-related hacking.
The actions amounted to the strongest American response yet to a state-sponsored cyberattack.
In retaliation, Mr. Lavrov recommended on Friday that 31 American 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 island used by diplomats, as well as a warehouse in the southern, industrial part of the Russian capital.
It was not yet clear if there would be further measures, as the United States took a two-pronged approach involving expulsions as well as sanctions. But they seemed to be a relatively restrained response reflecting the overall mood in the Russian government — that the Kremlin would wait three weeks for the inauguration of Donald J. Trump and hope that relations might improve.
United States intelligence agencies have concluded that the G.R.U., 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 Mr. Trump’s presidential campaign.