An overnight outline deal struck by the prime ministers of Russia and Ukraine aims to restore gas supplies to eastern Europe, crippled since January 7 in a dispute between Moscow and Kiev over prices.
Following is a look at who stands to win and lose from the dispute and its apparent resolution:
Russia has seen its reputation as a reliable energy supplier severely dented by the episode. But the Kremlin is likely to have calculated that with Europe dependent for years to come on its gas and unable to find alternatives quickly, it can afford to temporarily upset some European nations in the hope of gaining higher long-term prices for its gas, a key export.
The worst affected nations lay in central and south-eastern Europe while major European powers Germany, France and Italy – Russia's key trade partners – were less badly hit. If the deal holds, Moscow appears to have secured its long-cherished dream of forcing Ukraine to pay more than twice as much for its gas. The draft deal pledges Kiev to pay European-level gas prices, albeit with a 20 per cent discount this year.
There are other long-term advantages for Russia.
Other former Soviet states will think long and hard before arguing when Russia imposes full European market prices on them; the Kremlin is in no mood for compromise and has shown yet again that – as with the Georgia war last summer – it does not mind angering the West in order to advance its own agenda.
If the deal holds, Russian gas giant Gazprom will earn billions of dollars of extra revenue in coming years, more than making up for what it lost at the start of this year.
Less clear is whether Gazprom will succeed in convincing the Balkan nations through which its planned South Stream gas pipeline will run that the recent disruption to their gas supplies was all Kiev's fault.
South Stream would bring Russian gas directly to southeastern Europe under the Black Sea, bypassing Ukraine.
But having suffered the consequences of a Russian gas cut-off this year, Balkan nations may not be so keen on making themselves even more dependent on Moscow for energy.
The EU may win more converts for its alternative southeast European gas pipeline, Nabucco, but the project still faces hurdles in finding financing and getting enough gas from producing nations committed to fill it.
The likely suppliers, Azerbaijan, Turkmenistan and maybe Iran, are no more palatable to the West politically than Moscow.
Gazprom's other big pipeline project, Nord Stream, which aims to supply Germany via the Baltic Sea, looks more assured. Chancellor Angela Merkel reiterated her support for the project during Prime Minister Vladimir Putin's visit to Germany on Friday and Germany was not badly hurt by the Russian gas shut-off.
Within the Russian power structure, the deal confirmed yet again that Vladimir Putin reigns supreme. It was the premier who did the hard bargaining with Ukraine's prime minister and struck the deal in the early hours of yesterday morning, appearing on television screens to announce it.
Putin also gains domestically, by appearing as a tough leader who got what he wanted. Ukraine's Nato ambitions and its strident pro-Western stance have angered many Russians who think of Ukraine not as a sovereign nation but as a core part of the Soviet Union; as they see it, Putin is right to take a hard line with Kiev and force it to accept what Moscow wants.
During Putin's 2000-2008 presidency, it would have been inconceivable for the prime minister to have negotiated such an important deal and announced it without the president being involved.
By contrast, President Dmitry Medvedev was relegated to chairing a two-hour "summit meeting" of gas-consuming nations at the Kremlin on Saturday, which was boycotted by all EU nations except Slovakia and the Czech Republic and produced no tangible results.
It appears that Medvedev did not attend the key negotiating sessions with Ukraine's Prime Minister Yulia Tymoshenko, despite the fact that his former role as chairman of Gazprom would on paper make him the politician best qualified to find a solution.
The affair underlines once again that Medvedev plays a junior role in Russia's governing duo.
Ukraine's reputation with the European Union has taken a big hit. Kiev aspires longer term to membership of the Union but the way it brawled with Russia over gas prices, apparently oblivious of the consequences for energy supplies to its neighbours, will not have won it any friends further west.
Kiev is also unlikely to win much sympathy for its core argument, that it cannot afford European-level gas prices. Most of its neighbours already pay such levels and the draft agreement foresees Ukraine paying those anyway from next year.
Ukraine's Prime Minister Yulia Tymoshenko, who has her eye firmly set on the country's presidency in elections one year from now, appears to have shown she can strike a deal with Moscow – assuming the agreement holds. She seems to have secured at least one concession, a 20 per cent discount on European prices for Ukraine's gas this year.
But it remains unclear whether the deal – struck at a much higher price than the one on offer to Kiev last year – will help her political fortunes in her big domestic political battle with Ukrainian President Viktor Yushchenko. Already struggling with disastrous poll ratings at home, Yushchenko may have lost further sympathy abroad by taking a hard line in the dispute and making little apparent effort to come to terms with Moscow.