"This is another major milestone achievement in China-Russia energy strategic cooperation," Chinese state energy giant China National Petroleum Corp (CNPC) said.
It said the deal was "facilitated and greatly supported personally by the leaders of China and Russia".
Under the 30-year deal, the east route pipeline is scheduled to start providing China with 38 billion cubic meters of natural gas annually from 2018.
The gas deal was inked in Shanghai during the visit of Russian President Vladimir Putin to attend the Conference on Interaction and Confidence Building Measures in Asia in the eastern China metropolis.
Also Read
China is constantly seeking resources to power the growth of its economy.
Talks, which started in 2004 were stalled over price.
The two countries already have a 1,000 km-long oil pipeline which supplies over 15 million tonnes of Russian oil to China in 2012.
Two documents, China and Russia Purchase and Sales Contract on East Route Gas Project and a memorandum, were signed at a ceremony attended by Putin and Chinese President Xi Jinping.