(Bloomberg) -- Explore what’s moving the global economy in the new season of the Stephanomics podcast. Subscribe via Apple Podcast, Spotify or Pocket Cast.

Consumption and exports helped the German economy stay above water in the third quarter, when it unexpectedly eked out a modest expansion to avoid a recession.

Government and household expenditure accelerated, while exports rebounded after a steep decline, according to figures published Friday. That was enough to offset a 2.6% drop in machinery and equipment investment -- the biggest in more than six years -- and help the economy register 0.1% growth.

The weakness of investment bears out warnings that uncertainty related to global trade tensions has put executives on edge and made companies reluctant to spend. There’s additional pressure on Germany from a slowdown in the car market, which is a huge part of the country’s manufacturing industry.

After a 0.2% contraction in second quarter, Europe’s largest economy is barely growing and on track for a full-year expansion of just 0.5%. That would be less than half the euro-area average and mark the worst reading since 2013.

Germany’s pace in the third quarter was the same as Italy’s and lagged behind France and Spain. Average growth in the 19-country euro region was 0.2%.

However, there have been some positive signs recently, with German business sentiment stabilizing after months of declines. Purchasing Managers’ Indexes due on Friday are forecast to show another modest improvement in measures for both manufacturing and services.

More broadly, global investor optimism has picked up and the risk of a recession has been fading. Much depends on the unfolding of U.S.-China trade talks, where progress appears to change on an almost daily basis.

--With assistance from Harumi Ichikura and Kristian Siedenburg.

To contact the reporter on this story: Fergal O'Brien in Zurich at fobrien@bloomberg.net

To contact the editors responsible for this story: Craig Stirling at cstirling1@bloomberg.net, Jana Randow

©2019 Bloomberg L.P.