By Vladimir Soldatkin and Timothy Heritage
MOSCOW, May 8 (Reuters) - Russia and China signed a $25 billion deal to boost Chinese lending to Russian firms and a host of other accords deepening economic cooperation on Friday as Moscow's ties with the West fray over the Ukraine crisis.
Russian President Vladimir Putin and Chinese leader Xi Jinping hailed their countries' improving relationship after Kremlin talks and a signing ceremony on the eve of a military parade marking the end of World War Two in Europe.
Xi is among about 30 foreign dignitaries attending the anniversary events in Moscow but the Red Square parade is being shunned by Western leaders in a show of displeasure over Moscow's role in the conflict in Ukraine.
In a further sign of Moscow's eastward shift, China and Russia are due to hold joint naval exercises next week in the eastern Mediterranean and Chinese soldiers will take part in Saturday's military parade.
"Today China is our strategic and key partner," Putin said after he and Xi presided over a signing ceremony in front of rows of Chinese and Russian officials in the Kremlin.
Xi, who like Putin looked relaxed, invited the Russian leader to attend war commemorations in China on Sept. 3. Putin accepted, saying their countries had suffered most in the war.
The Chinese president said the talks had shown Beijing and Moscow shared the same views on many global problems.
Both leaders said it was necessary to guard against a resurgence of fascism and attempts to rewrite history, echoing previous comments by Putin criticizing the West and Ukraine for, in his view, underestimating the Soviet role in ending the war.
Despite both being Communist-run in Soviet times, Beijing and Moscow almost went to war in the 1960s over a border dispute but relations have improved steadily since the end of the Cold War, especially since the West imposed economic sanctions on Russia last year over its seizure of Ukraine's Crimea peninsula.
Last May they agreed a $400-billion deal for Russia to supply China with 38 billion cubic meters (bcm) of gas annually from 2018 for 30 years.
Building on that deal, natural gas producer Gazprom signed a deal on Friday with China National Petroleum Corp (CNPC) on the main terms of providing supplies via what is know as the Western route.
An agreement was also signed to boost Chinese lending to Russian firms, some of which have been hit badly by an economic crisis aggravated by the sanctions and weaker global oil prices.
Kirill Dmitriev, chief executive officer of the Russian Direct Investment Fund, told Reuters that Russian companies could receive up to $25 billion over the next three years.
The sides agreed to launch a $2 billion investment fund targeting agricultural projects and signed a deal for Russia's Sberbank to open a 6 billion yuan ($966 million) credit line with China Development Bank.
Russian Transport Minister Maxim Sokolov said the countries would invest 1 trillion roubles ($19.7 billion) in a rail link between Moscow and the Russian city of Kazan to be completed by 2020. Putin said the level of Chinese investment would be around 300 billion roubles.
Although relations are improving, it has not proved as easy as some Russian officials had hoped to secure funds from China, with some suspicion lingering in the relationship.
Russia is wary of becoming the junior partner and little more than a provider of natural resources for China's booming economy, the world's second biggest after the United States. (Additional reporting by Alexander Winning, Elizabeth Piper, Jack Stubbs, Gleb Stolyarov and Jason Bush; Writing by Timothy Heritage, editing by Elizabeth Piper and Gareth Jones)