MOSCOW — When Russian natural gas flowed into northern China on Monday, as Presidents Vladimir Putin and Xi Jinping ordered the taps open, it sent geopolitical ripples across the globe.

On one side of the border, Russian gas workers, clad in gray and blue, stood at attention in the Atamanskaya gas compressor station near Blagoveshchensk, close to the Chinese border, waiting for Putin’s order to start the flow. Across the border, their Chinese counterparts in bright red overalls stood ready to receive the gas.

The moment was captured on a video link between the two presidents, depicting the gas as little white arrows on the screen, flooding through a blue pipe. The $55 billion pipeline, Power of Siberia, runs almost 1,865 miles from gas fields in Irkutsk and Yakutsk in Siberia to the Chinese border. It represents the latest powerful symbol of the growing ties between Moscow and Beijing, even as China and the United States are engaged in a trade war.

The pipeline enables Russia to tap into China’s vast, expanding market for gas as part of a 30-year, $400 billion gas supply contract that promises to soften the impact of Western sanctions on Russia over its 2014 annexation of Crimea. In China, the pipeline will run 3,175 miles from Heilongjiang province in the northeast to Shanghai.

The contract between state-owned Russian gas giant Gazprom and the China National Petroleum Corp. allows Moscow to diversify its markets away from Europe, where most of its gas has flowed in the past.

Russia and China have been moving closer, determined to counter U.S. global power. At a June meeting in St. Petersburg, where the two countries signed a flurry of trade deals, Xi called Putin his “best and bosom friend” and announced that Beijing would send two pandas to Moscow, always a sign of Chinese diplomatic warmth.

In a symbol of the strengthening military ties between Moscow and Beijing, Russia and China staged their first joint air patrol in the Asia-Pacific region in July, scrambling Japanese and South Korean air defenses.

Russian supplies to the Chinese gas market could create obstacles for suppliers of pricier U.S. gas and help strengthen Beijing’s hand in trade talks with Washington.

The Russia-China gas pipeline launch comes as Russia races to finish a western pipeline via the Baltic Sea to Germany, Nord Stream 2, which would allow Russia to pipe gas to Europe while bypassing Ukraine.

Russia has 20 percent of the world’s natural gas reserves and accounts for 17.3 percent of global gas production, supplying nearly 21 percent of Europe’s pipeline gas imports.

Alexander Gabuev, an analyst on China-Russia relations at the Carnegie Moscow Center, said that the Power of Siberia pipeline sent a message to Europe and the United States about closer ties between Beijing and Moscow but that eventually China could use it to exert pressure for lower gas prices.

“The deal is a symbol of Putin’s pivot to China,” he said.

“In the longer term, cheap pipeline gas from Russia will be in competition with American gas,” Gabuev said, but because the Russian pipeline has just one customer — China — Beijing could exert pressure on Russia, pushing gas prices down.

Energy analyst Andrew Hill, head of the S&P Global Platts gas and power analytics team for Europe, the Middle East and Africa, wrote in a recent blog post that Russia’s position in global gas supplies has never been more dominant.

“This privileged position of resource endowment gave Russia a strength it has had no hesitation using to further its own political, geopolitical and strategic aims over the years,” he said. “By positioning itself between the European markets to the west, and the rapidly growing gas hungry Chinese markets to the east, Russia is not only creating new income streams, but hedging its bets and bolstering its position strategically.

Hill added: “The deal with China is very much a marriage of convenience. Russia has the gas that China wants, with Russia willingly accepting all the associated geopolitical advantages and the increase in its status.”

It also gives Russia the ability to play one market against the other, he said.

Putin said the 2014 gas-supply contract with China was the biggest agreement in the history of Russia’s gas industry.

The pipeline posed an engineering challenge, traversing swamps, rocky mountains, areas prone to earthquakes and regions of permafrost where the temperature fell to minus-50 degrees Celsius (minus-58 degrees Fahrenheit) last winter.

Gazprom chief executive Alexey Miller said 10,000 workers took part in the construction of the pipeline, which used 130,000 pipes.

“Deliveries of Russian gas to China by pipeline will raise Russian-Chinese strategic energy cooperation to a qualitatively new level and bring the goal of increasing bilateral trade turnover to $200 billion in 2024 closer to being realized,” Putin said, speaking in Sochi, Russia. “More than a trillion cubic meters of gas will be delivered to China through the Power of Siberia pipeline over 20 years.”

Xi said the pipeline was a milestone in energy cooperation that underscored the deep integration between the two countries. He also hosted Nikolai Patrushev, head of the Russian Security Council, at the Great Hall of the People in Beijing on Monday, saying that Beijing and Moscow would stand together against interference from Washington and others.

“This year the United States and some other Western countries have increased their interference in the internal affairs of China and Russia, threatened the sovereign security of the two countries, and impeded their economic and social development,” Xi said, according to the official Xinhua News Agency. He warned that such an approach would only harm those nations.

China will be the main engine of an increase in global gas demand up to 2024, accounting for about 40 percent, according to the International Energy Agency.

The Nord Stream 2 pipeline, being constructed by Gazprom and European partners, is more than 80 percent complete and due to begin operations in the middle of next year. But the project could be frustrated if the United States imposes threatened sanctions on the companies laying the pipeline.

Ukraine, which earns about $3 billion annually from fees for the transit of Russian gas to Europe, has been urging U.S. officials to stop the Nord Stream 2 pipeline. Moscow and Kyiv have been struggling to reach a deal on gas transit amid friction over Russia’s annexation of Crimea and its backing of pro-Russian separatists in the war in eastern Ukraine. The current agreement, negotiated in 2009, expires at the end of the year.

A second gas pipeline being built from Russia to Turkey, TurkStream, also would bypass Ukraine, supplying Turkey and southern Europe.

In the coming year, the gas flow in the Power of Siberia pipeline to China will be limited, amounting to 4.6 billion cubic meters in 2020, according to Gazprom, and rising to 10 billion cubic meters in 2021. But Gazprom has declared its ambition to provide 38 billion cubic meters to China by 2025 and to supply a quarter of China’s liquefied natural gas imports by 2035.

The project also threatens to undercut China’s traditional suppliers such as Australia, which has had an increasingly fraught relationship with Beijing in recent years.