Three years ago, the steel mill outside the small city of Smederevo, Serbia, appeared headed for the scrap heap.

The Serbian government, which owned the mill, had stopped subsidizing it after six straight years of losses. Hemorrhaging cash, it struggled to buy spare parts and raw materials such as iron ore.

“It was like trying to drive a car...