HONG KONG—For Chinese leader Xi Jinping , Russian President Vladimir Putin is a useful partner in opposing a U.S.-dominated world order.

But the relationship also represents a liability for China as American and European officials warn Beijing against aiding Russia’s efforts to rebuild its military .

Putin arrived in Beijing on Thursday, in his first trip abroad since he secured a rubber-stamp election victory in March. The two leaders declared a “no limits” friendship shortly before Russia invaded Ukraine in 2022.

Since then, China has been less effusive even as it has provided a lifeline to Russia’s economy. Putin will be seeking more of the support that has helped Russia resist Western efforts to isolate it. The visit will also give him an opportunity to demonstrate to the Russian public that he still has powerful friends—a message often stressed by state media.

“Putin, of course, will like to see some sort of very persistent Chinese endorsement,” said Zhu Feng , a professor of international relations at Nanjing University.

What Putin is more likely to get is a continuation of China’s policy to help Moscow prop up its economy, buying up its cheap energy exports and selling it the consumer goods Russia increasingly struggles to import from elsewhere.

China hasn’t publicly criticized the invasion of Ukraine, which it officially calls a “crisis” rather than a war. Xi has rejected suggestions that Beijing should do more to press Moscow to end the war. But the Chinese leader has also warned against use of nuclear weapons, a specter that Putin has occasionally raised over Ukraine.

“On the one hand we are very opposed to the use of military force against other countries,” said Zhu. “On the other hand, we don’t want relations with Russia to completely collapse. They’re our neighbor, China is a big buyer of Russian oil and gas. Beijing would just like to see the relationship go on without distraction. But as long as the war persists, it is a diplomatic dilemma for China.”

The relationship between the two countries is underpinned by a longstanding friendship between the two leaders, who have met each other dozens of times and frequently exchange gifts and birthday wishes. Xi’s first foreign trip after securing a third term last year was to Moscow.

Putin’s trip comes just a week after he was inaugurated for another six-year term . China has become an important outlet for him diplomatically, as he is increasingly shunned internationally and limited in his ability to travel after the International Criminal Court issued an arrest warrant for him.

The two countries have grown closer during the war, with trade growing last year by more than 26% to $240 billion. That growth has stalled in recent months, but experts say that significant volumes are moving through third countries in Central Asia such as Kyrgyzstan.

China is a big customer of Russian oil and natural gas, which it can buy at a markdown as Europe has curbed such purchases since the start of the war. Russia also looks to China for consumer goods, providing a steady market at a time of weak global demand. Chinese vehicles have surpassed many European brands in Russia, helping China become the world’s biggest car exporter last year.

“The general framework of this relationship is pretty solid,” said Jakub Jakobowski , a China researcher and deputy director of the Centre for Eastern Studies, a Polish government-funded think tank. “As long as the strategic conflict with the U.S. is in place, and probably not going away anytime soon, they will lean on Russia as the only viable partner.”

The U.S. has accused China of helping Putin rebuild his military, supplying chips used in advanced weapons, jet parts, drone engines and earth movers. China denies it has supplied any arms to Russia and says it closely regulates so-called dual-use equipment with potential civilian and military applications.

While the U.S. has sanctioned Chinese companies for providing military technologies such as chips and optics to Russia, it has thus far held off on sanctions that would cut off Chinese banks from the global financial system, a move that could have broad economic impact.

Putin’s visit comes on the heels of Xi’s trip to Europe , where he met with leaders in France, Serbia and Hungary. Each stage of the Chinese leader’s visit seemed designed to appeal to the segments of Europe that are less eager to embrace the U.S.’s tough stance toward China, analysts said.

“From Putin’s point of view, or the China-Russia relationship point of view, this European visit was just great, the way Xi Jinping devised it,” Jakobowski said. “If you look at the countries he visited and the overall context, it’s clear this was very anti-American.”

In addition to Beijing, Putin will also visit Harbin, a city in northeastern China that was developed by Russia starting in the late 19th century as the hub of a railway network in the region. The city retains some of its historic Russian architecture and is hosting a Russia-China Expo that focuses on trade and investment ties between the two countries.

Putin’s visit to China’s northeast has added to speculation that he could also travel to North Korea, a country that Russia has grown closer to since the start of the war in Ukraine. Putin   met with North Korean leader Kim Jong Un in Russia in September, and Moscow has turned to North Korea to supplement its own arms production as its supplies are exhausted by the war in Ukraine. In January, the Kremlin said Putin would pay a visit to Pyongyang in the near future.

The growing Russia-North Korea ties have caused some discomfort in China, which worries that it could be lumped into a grouping reminiscent of their alignment during the Korean War, said Zhu, the Chinese scholar.

“Beijing totally rejects falling into a new Cold War,” said Zhu.

Speaking to Chinese state media ahead of his visit to China, Putin said Russia and China had a common goal in standing up to the U.S. and its allies. “We also reject Western attempts to impose an order based on lies and hypocrisy, on some mythical rules of no one knows whose making,” he told the state-run Xinhua News Agency.

Putin also said he supported China’s efforts to promote an end to the fighting in Ukraine. Last year China issued a position paper on Ukraine and has dispatched an envoy, Li Hui , to European capitals to discuss potential diplomatic solutions. But China’s position was seen by European officials as closely matching Russia’s . Beijing’s argument that Russia has rights to “indivisible security,” with no other country’s security efforts threatening its own, follows Putin’s justification for invading Ukraine.

Write to Austin Ramzy at austin.ramzy@wsj.com