Germany’s export-oriented economy used to be a reliable engine for pulling Europe out of slumps. Now, as the continent emerges from a pandemic torpor, Germany is lagging behind.

German manufacturers are struggling to produce cars and factory equipment because of parts and labor shortages. They face surging energy prices that are making sky-high electricity bills even higher. And they must invest hundreds of billions of dollars over coming years to meet new clean-energy standards.

The era of easy foreign trade and rapid globalization has given way to geopolitical tensions, transport bottlenecks and pressure to manufacture locally. Chinese businesses, Germany’s biggest customers, are turning into competitors. Demand for German luxury cars hangs in the balance as the world shifts toward electric vehicles.

German industrial output in August was about 9% below its 2015 level, compared with a 2% increase for the eurozone as a whole, according to the European Union’s statistics agency. In Italy, whose manufacturers are closely tied with Germany’s, industrial output rose about 5% over the six-year period.

The International Monetary Fund recently lowered its forecast for German economic growth in 2021 to 3.1%, from 3.6%. It expects Germany’s economy to recover roughly in line with France and the U.K. through 2022, then fall behind starting in 2023.

The malaise is fueling a debate among business and political leaders over whether the German economy needs a reboot and what it should look like. The three parties negotiating a new coalition government following September’s election want to increase public investments, raise wages and streamline planning procedures, which could boost domestic sources of growth and make companies less dependent on foreign demand.

If implemented, the plans would represent the most comprehensive economic overhaul in years. Some economists think they also carry significant risks.

Economic StallGerman industrial production has stalled​amid geopolitical tensions, transport​bottlenecks and a shift to green energy industrial production index, manufacturing source: Organization for Economic Cooperation and​DevelopmentNote: 20

The weakness in Germany’s economy predates the Covid-19 pandemic. German industrial output and exports began stagnating in 2017, posing a problem for an economy where some 30% of jobs and output are tied to overseas demand, roughly four times the share in the U.S.

The last time growth in Germany lagged markedly behind that of European neighbors was in the late 1990s and early 2000s, before a series of unpopular economic overhauls revived the country’s competitiveness. For a few years, Germany was the world’s biggest exporter of goods.

Hans Eichel, a former German finance minister who presided over some of those reforms in 2003, said that today “the external environment is more difficult than 20 years ago. Even China is looking more and more toward internal demand.”

At Wilo SE, a pump manufacturer in northwest Germany, sales rose by more than 50% in the eight years through 2017, to €1.4 billion, or about $1.6 billion, driven mainly by new markets such as China. Since then, its sales, most of which come from outside Germany, have been roughly flat.

To guard against trade disruptions and protectionism, Chief Executive Oliver Hermes said, the company is shifting production and executives closer to its customers. It is establishing a second headquarters in Beijing and plans a third in the U.S., and will add production sites in China and India.

The shift toward more localized production could mean “less export from Germany,” Mr. Hermes said, meaning fewer jobs in its home country. The company recently said it would close a factory in Eastern Germany, cutting or shifting 120 jobs.

Like other German auto suppliers, Mann+Hummel, a manufacturer of air-filtration systems based in southern Germany, faces a tricky transition as gas and diesel engines are phased out. Its sales declined about 9% last year as global car sales slowed during the pandemic.