Chinese leader Xi Jinping extended his tour of Europe with stops in Serbia and Hungary, the two countries on the continent that have embraced Moscow and Beijing most warmly and challenged a U.S.-led world order .

In Serbia on Wednesday, Xi was greeted on the tarmac by President Aleksandar Vucic and entered Belgrade’s city center decorated with a panoply of Chinese flags flanking the main roads. Following talks with Xi, Vucic praised what he called the Chinese leader’s teachings and took pride in saying he had invited him to visit more times than any other world leader.

Serbia has been a haven of pro-Chinese sentiment at a time when Beijing is facing headwinds in Europe, including criticism of its support for Russia following the invasion of Ukraine and trade practices that have undermined Europe’s critical industries. Hungary, where the Chinese leader arrived late Wednesday, is poised to outdo Serbia’s fanfare as both vie for Chinese investments to boost their modest economies.

Xi arrived in Serbia on the symbolically important 25th anniversary of the bombing of the Chinese Embassy in Belgrade by North Atlantic Treaty Organization forces, during the Atlantic bloc’s 2½-month bombing campaign on Serbia. The midnight bombing of the embassy, which Washington at the time said was a mistake, killed three Chinese citizens and sparked riots in Beijing. Since then, Beijing has held out the strike to criticize the alliance, using it as Exhibit A to imply that NATO is responsible for provoking Russia into a war in Ukraine.

“Chinese-Serbian friendship has been forged through our extraordinary fight together to promote world peace and development and forged with the blood and lives of our two people,” Xi said at a signing ceremony for bilateral agreements that spanned cultural and scientific exchanges as well as a free-trade agreement on some agricultural goods.

Xi didn’t make a publicized visit to the embassy, unlike the last time he was in Serbia when he laid a wreath at the compound. In a letter in Serbian newspaper Politika, he condemned the “flagrant” strike, writing, “the Chinese people cherish peace, but we will never allow such tragic history to repeat itself.”

Vucic called tensions between Taiwan and China an internal issue, reiterating his support for Beijing’s One China policy , which holds that Taiwan is part of China. The Serbian leader sought to draw parallels with Kosovo, which declared independence in 2008 but is still claimed by Serbia.

Xi’s stop in Serbia comes after a two-day visit in France , where the Chinese leader and French President Emmanuel Macron discussed Ukraine and trade. The two also jointly expressed support for the idea of a truce during the Summer Olympics, which will be held in Paris this year.

In Hungary, Prime Minister Viktor Orban is expected to showcase his efforts to attract Chinese investment despite Washington’s efforts to curb Beijing’s ties more broadly in Europe.

Orban was the first European Union leader to sign a Belt and Road contract with China, and the scope of the relationship has ballooned in recent years with more than $16 billion dollars of continuing investment projects in Hungary.

China-based Contemporary Amperex Technology is building a $7.8 billion electric-vehicle battery plant in Hungary. BYD, China’s top-selling electric-vehicle maker, is likewise building a manufacturing plant in Hungary’s southern city of Szeged. China watchers say another plant may be on the table for Xi’s visit on Thursday and Friday.

Orban has given China a place inside the central European automotive-supply chain while throwing his weight behind Beijing-led construction on a rail link meant to connect Hungary and the Serbian capital, Belgrade, easing the transport of goods to the heart of Europe.

“Orban is putting his bets on China. It has been very clear that the government wants to turn the country into a logistical hub,” said Tamas Matura , a senior fellow at the Center for European Policy Analysis. “They also believe in manufacturing, industry and the re-industrialization of the country, which the Chinese are only too happy to help with.”

Write to Thomas Grove at thomas.grove@wsj.com