In fact, holding a World Cup in Russia today seemed like a terrible idea to many. The British royal family, for example, boycotted the event, after the poisoning earlier this year, by nerve agent, of a former Russian double agent in Britain.

Not only had Russia been nailed in a state-sponsored doping scandal at the last major international sports event it hosted, the 2014 Winter Olympic Games in Sochi, its soccer team was widely regarded as a joke, both at home and abroad. As the home team it gained an automatic berth, even though it was ranked 70th in the world, the lowest among participating countries.

But on Sunday night, Russia knocked off Spain in an almost unfathomable upset, and is now among the final eight teams. It was this victory that touched off the gigantic alcohol- and pride-fueled street party throughout central Moscow, including, improbably on the doorstep of Lubyanka.

Pretty much everything has gone right. Stadium crowds have been enthusiastic and reports of violence and logistical incompetence few. Russia’s soccer hooligans, usually a vicious group, are nowhere to be seen. (The F.S.B. reportedly held “prophylactic discussions” with their leaders beforehand, to discourage unrest.)

All of this has played into Mr. Putin’s hand at a pivotal time. With the tournament as a distraction, Russia’s Parliament set to work drafting a law to lift the retirement age, an unpopular measure needed because of economic stagnation brought on by sanctions.

The games have also sanded some hard edges off Russia’s reputation as a troublemaker, even as nothing has changed in Ukraine or Syria. Yet rights groups including Amnesty International and Human Rights Watch have tried to use the spotlight of the World Cup to free political prisoners, so far without luck.