“While we reserve the right to take reciprocal measures, we’re not going to downgrade ourselves to the level of irresponsible ‘kitchen’ diplomacy,” Mr. 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 Donald J. Trump.
Mr. Putin has a flair for smart, unexpected tactics, and his announcement on Friday appeared to be in keeping with that. To some observers, the sudden shift seemed carefully stage-managed, a way of building up suspense before Mr. Putin’s surprise announcement, helping portray him as a wise leader above the fray.
Mr. Putin even said he did not want to close a wooded picnic area on a Moscow River island used by diplomats because he did not want to deprive their children. Then 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.
“Putin showed that he is above his own officials, that he doesn’t want to take the retaliatory action suggested by his foreign minister,” said Vladimir Frolov, an international relations analyst and columnist. “This is an attempt to show that he is a figure not just of worldly scale, but of planetary.”
Should Mr. 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 Trump with a nettlesome diplomatic standoff from the moment he arrived in the Oval Office.
But by choosing essentially to disregard Mr. Obama’s punitive measures, Mr. Putin can try to disarm his American critics, including members of Congress who consider him an aggressive foe of the United States. That could give Mr. Trump more room to pursue the closer cooperation with Russia that he has advocated.
Despite all of the statements from senior officials about the need to respect “reciprocity,” Mr. Putin essentially warned Washington that he was waiting for the Trump administration — a tactic not unlike the one adopted by Israel in its recent rejection of a peace plan laid out by Secretary of State John Kerry.
“Moscow wanted Trump to have room to maneuver,” Mr. Frolov added. “This decision is a clear gesture of good will toward him.”
Mr. Putin called it “unfortunate” that the Obama administration chose to end its relationship with Russia in such a way, but he sent a New Year’s greetings to Mr. Obama, his family, Mr. Trump and “all the American people.”
Just hours earlier, Mr. Lavrov had recommended that 31 American diplomats be expelled from Moscow and four from St. Petersburg. He also recommended the closing of two facilities: the picnic area 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,” Mr. Lavrov said. “Reciprocity is the law of diplomacy and of international relations.”
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 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.
The actions amounted to the strongest American response yet to a state-sponsored cyberattack.
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.
In addition to giving the Russian diplomats and their families 72 hours to leave the country, the measures announced by Mr. Obama imposed sanctions on Russia’s two main intelligence services. Washington described the diplomats as intelligence agents working under the cover of diplomacy.
Russia announced it would send a special plane to collect the diplomats and their families by the Jan. 1 deadline.
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 Mr. Putin’s who were considered crucial in the annexation of Crimea in 2014 and in destabilizing Ukraine.
The economic sanctions covered three main areas, including blocking Russian access to international credit, cutting off cooperation in advanced oil field technology and stopping arms deals or the sale of dual-use technology.
Much of their effect stemmed from the fact that they coincided with a sharp drop in global oil prices, hitting Russia with a double blow. Companies had trouble obtaining credit, driving up the short-term cost of borrowing and compounding a deep recession. Over the long run, the effect is likely to be strongest in the oil sector because it dried up most exploration in difficult areas like the Arctic.
Russia responded with sanctions of its own, mostly banning agricultural products and certain foods imported from the West. Mr. Putin and other officials have repeatedly crowed that this resulted in a successful campaign of “import substitution.”
Russia also maintained a secret list of Western officials who were no longer allowed into the country. Most, like the former American ambassador Michael McFaul, discovered it only when they applied for visas to Russia.
Before Mr. Lavrov spoke, Maria Zakharova, a Foreign Ministry spokeswoman, took to Facebook to denounce the Obama administration.
Ms. Zakharova called the administration “a group of a foreign-policy losers, embittered and narrow-minded.”
“Today, America, the American people, were humiliated by their own president,” she wrote.
There is a long history of reciprocal expulsions and other measures between the United States and Russia, even after the Cold War ended with the collapse of the Soviet Union in 1991.
While Mr. Obama framed the new American measures as a response to Russian hacking during the election, the expulsion of Russian diplomats from Washington and San Francisco was described as a response to continued harassment of American diplomats in Russia.
Mr. Putin’s spokesman, Dimitry S. Peskov denied that any such harassment had taken place, but American diplomats tell a different story. Many travel around Moscow in cars with red diplomatic license plates that start with 004, denoting United States Embassy vehicles. That makes them easy targets for traffic stops.
Embassy employees said they were followed as they moved around the city, and that sometimes, when they were not at home, agents would enter and move the furniture around, just to show that they had been there.
Some find it unnerving, while others shrug it off as part of the job. One young father said he was just grateful that his children were too small to realize that the family was being followed.