BEIJING — The Chinese leader, Xi Jinping, has selected Moscow as his first foreign capital to visit as president, to be followed immediately by a trip to South Africa for a summit meeting of the group of leading emerging-market countries.

His predecessor, Hu Jintao, also chose Moscow as his first overseas stop after assuming office, but Mr. Xi’s journey to Russia has a special significance, analysts say. It comes as China tries to answer the Obama administration’s shift toward Asia, a policy that is viewed with suspicion in Beijing as an effort to contain China.

By going to Russia, Mr. Xi will be working to ensure that China’s relationship with Moscow — a sometimes prickly affair in which the balance of power has tilted sharply in China lately — is in good shape before he meets with President Obama later in the year, analysts said.

There have also been indications that Mr. Xi and the Russian president, Vladimir V. Putin, would try to hammer out a long-sought energy deal that would provide China with Russian oil and gas. “China wants to consolidate its position with Russia before dealing with the United States,” said Jin Canrong, associate dean at the School of International Studies at Renmin University. In particular, he said, China is likely to seek Russian support in its territorial dispute with Japan, an American ally, over islands in the East China Sea.