By Julia Horowitz, CNN Business

Germany's economy shrank in the second quarter as global uncertainty and the trade war took a toll on its manufacturers.

GDP for the three months ended June contracted 0.1% compared to the previous quarter, in line with analyst expectations. That's down from 0.4% growth in the first three months of the year.

"Today's GDP report definitely marks the end of a golden decade for the German economy," said Carsten Brzeski, chief economist in Germany at the Dutch bank ING.

The world's fourth largest economy, and Europe's biggest, has been hit by what analysts have described as a "perfect storm" of negative factors.

Germany relies heavily on exporters that sell a large amount of goods to China and the United States, which are locked in a bitter trade dispute. Weak global auto sales have also hit the country's carmakers, and fears of a disorderly Brexit remain a drag.

A challenging backdrop

The German economy has helped support growth in Europe following the global financial crisis.

But industrial output for June dropped over 5% compared to the previous year. And the ZEW indicator of economic sentiment for August plunged sharply, hitting its lowest level since December 2011.

Brzeski said the uncertain climate was a top negative factor. "Increased uncertainty, rather than direct effects from the trade conflicts, have dented sentiment and hence economic activity," he said.

Another core issue is the global decline in demand for autos — especially in China, where new car sales have dropped 13 months in a row. That's a huge problem for German carmakers such as BMW, Daimler and Volkswagen, which have come to depend on the world's largest market for vehicles.

It's particularly damaging at a moment when Germany's automakers have to make big investments to build cleaner cars, said Oliver Rakau, chief German economist at Oxford Economics.

Throw Brexit into the mix, and the outlook for Germany's economy looks grim. Even so, Rakau said he expects a return to "modest" growth in the current quarter, helped by "resilient" domestic demand.

"The main question really is how exports and industry are going to fare," he said.

What happens next

The weak data bolsters the case for the German government to spend more to stimulate the economy next year, Rakau said. But that's far from a sure bet in a country that's notoriously wary about borrowing.

The government could face more pressure to intervene if the trade war between the United States and China drags on.

"The bottom line is that the German economy is teetering on the edge of recession," said Andrew Kenningham, chief Europe economist at Capital Economics.

The Trump administration said Monday it would delay tariffs on some consumer goods exported from China, including cell phones, toys and video game consoles. But both sides look no closer to striking a deal that would eliminate existing tariffs. A fresh round of taxes on Chinese exports is still set to go into effect in September.

Germany's contracting economy also bolsters the case for the European Central Bank to take action when it meets in September.

Economists predict that the central bank will move to cut interest rates, which are already at historic lows. The ECB is also expected to signal it will restart a bond buying program designed to spur economic growth.