China and Russia signed a $400 billion gas supply deal on Wednesday, securing the world's top energy user a major source of cleaner fuel and opening up a new market for Moscow as it risks losing European customers over the Ukraine crisis.
The long-awaited agreement is a political triumph for Russian President Vladimir Putin, who is courting partners in Asia as those in Europe and the United States seek to isolate him over Moscow's annexation of Ukraine's Crimea peninsula.
Commercially, much depends on the price and other terms of the contract, which has been more than a decade in the making.
China had the upper hand as talks entered the home stretch, aware of Putin's face-off with the West.
But both sides could take positives from a deal that will directly link Russia's huge gas fields to Asia's booming market for the first time - via thousands of miles of new pipeline across Siberia that form part of the package.
"This is the biggest contract in the history of the gas sector of the former USSR," said Putin, after the agreement was signed in Shanghai between state-controlled entities Gazprom and China National Petroleum Corp (CNPC).
"Our Chinese friends are difficult, hard negotiators," he said, noting that talks went on until 4 a.m.
"Through mutual compromise we managed to reach not only acceptable, but rather satisfactory, terms on this contract for both sides. Both sides were in the end pleased by the compromise reached on price and other terms," the president said.
Putin and Chinese counterpart Xi Jinping applauded as they witnessed the deal being signed before the Russian leader was to leave Shanghai at the end of a two-day visit.
The agreement came in time for a major economic summit in St. Petersburg starting Thursday. About a dozen chief executives and chairmen of major U.S. and European firms have withdrawn from the forum over the Ukraine crisis.
Putin loyalist and senior parliamentarian Alexei Pushkov, who was included on a U.S. list people placed under sanctions imposed after the crisis in Ukraine, said the gas deal showed Russia could not be isolated.
"B. Obama should abandon the policy of isolating Russia: it will not work," he tweeted, referring to U.S. President Barack Obama, who has pushed for greater Western punishment of Russia.
In Washington, State Department spokeswoman Jen Psaki said the gas deal would not undermine efforts by the United States to pressure Moscow not to meddle in Ukraine's affairs.
"Whether this specific