But what was in it for Serbia?

During Mr. Xi’s state visit, he said China would bring more jobs, improve living standards and lift the country’s economic growth. More important, by opening its economy to China, Serbia cemented Beijing’s support against European Union pressure to recognize Kosovo’s independence.

“It would not be immodest or wrong to say that Serbia is China’s main partner in Europe,” Serbia’s minister for construction, transportation and infrastructure, Zorana Mihajlovic, declared about Mr. Xi’s overtures.

Some in China have questioned the economic viability of the Beijing’s investment spree. And outside of China, some fear that China’s ambitions would keep the authoritarian leaders of countries like Serbia in power and leave the nations deep in debt and stuck with environmentally flawed projects.

But Mr. Xi’s words saved 5,200 jobs in Smederevo, a city of 100,000 that has depended on the steel mill for decades. China’s state-owned HBIS Group bought the steel mill, the only one in Serbia, for 46 million euros, or nearly $55 million at current exchange rates. Its previous owner, U.S. Steel, sold it to the Serbian government in 2012 for a symbolic $1.

“We want to create a win-win situation,” Mr. Xi said, shortly after the sale.

Now, China’s ambitions in the Balkan region have set up a potential clash with the European Union’s plans — with countries like Serbia placing themselves in the middle.