Europe’s largest economy stagnated in the fourth quarter as an inventory slump wiped out support from consumption and investment.

While the overall result means Germany just barely avoided a recession after the economy shrank in the previous three months, growth components paint a more upbeat picture—suggesting a pickup in the coming months. Consumer spending, capital investment and public spending all rose in the quarter.

The big drag in the quarter was inventories, which knocked 0.6 percentage point off GDP. That’s part of the hangover from auto-industry disruption over the summer and reflected carmakers finally shifting stocks.

“Cars have sidetracked the entire economy—however, in a couple of months, the German economy should be able again to show its true colors,” said Carsten Brzeski, chief economist at ING Germany. “The German economy is in a better shape than its current reputation.”

Economic momentum going forward will depend in large part on how willing companies are to continue investing in an uncertain external environment. A closely-watched gauge of business sentiment due later on Friday may offer some clues.

While Germany seems to be overcoming a number of temporary factors that have damped momentum, policy makers are concerned that subdued business expectations may hamper the chances of a rebound.

The slowdown, which has spilled into the wider euro area, has prompted officials to lay the groundwork for a potential monetary-policy response, just months after the European Central Bank halted net bond purchases. Germany’s Bundesbank, meanwhile, is still striking a positive tone, arguing there are “no signs that the slowdown is morphing into a downturn.’’

That’s despite signs that weakness in manufacturing has persisted into the new year. Purchasing managers’ indexes published Thursday showed a slump in industry, and investor confidence hasn’t yet seen a meaningful pickup. A number of public institutions and private-sector banks have revised down their forecasts for German growth this year.

The Ifo Institute’s gauge of business confidence probably deteriorated further in February. It will be updated at 10 a.m. Frankfurt time.