(Bloomberg) -- Germany’s economy probably stagnated in the final quarter of 2022, defying analyst expectations for a contraction and easing fears of a recession triggered by the war in Ukraine and soaring inflation. 

For the year as a whole, output increased 1.9% — down from 2.6% in 2021 and just ahead of the 1.8% estimate in a Bloomberg survey, the statistics office said Friday.

That slowdown came as Russia’s attack cut short the pandemic rebound, forcing painful shifts in business and politics. 

“Private consumption was incredibly robust in the fourth quarter, bolstered by a record increase in disposable income last year that helped cushion the inflation hit,” said Andreas Scheuerle, an economist at Dekabank. “Industry has also been stronger than expected, with carmakers playing no small role.”

There were high hopes as the year began that phasing out two years of Covid-19 restrictions would juice demand, with gross domestic product forecast to jump by 4%. After February’s invasion, however, 2022 ended with Europe’s largest economy confronting the harsh reality that its business model — underpinned by cheap natural-gas supplies from Russia — needs a major rethink.

Chancellor Olaf Scholz’s government did manage to find alternative sources of energy in short order, with unusually warm winter weather also helping. Businesses, meanwhile, recalibrated supply chains after production at some factories was forced to a halt in the war’s early days.

Much more work remains, though, and is complicated by the soaring costs that are set to dog businesses and consumers for years to come. Inflation peaked at 11.6% last year and will stay elevated through 2025, despite generous government relief measures.

“Despite an energy crisis and massive inflation pressure because of the war in Ukraine, supply shortfalls and the continued pandemic, Germany’s economy held up well,” Federal Statistical Office President Ruth Brand told reporters in Berlin, saying GDP has now passed its pre-Covid level. 

Even so, “in the international comparison, the growth of the German economy in 2022 probably was lower than in almost every other European country,” she said.

Economists started to predict a German downturn in September after confidence indicators plummeted and surveys of purchasing managers signaled production started to decline.

Recently, modest optimism has taken hold. Factories are maintaining production, despite softer demand, working through the long list of orders that have been held up by logistical bottlenecks.

Firms including Volkswagen AG say those snarls are now easing. The carmaker expects a boost to sales this year, pointing to orders of 1.8 million vehicles in western Europe that will help offset a sputtering global economy.  

Gas prices have also come off their peak after mild temperatures curbed consumption. The country is now expected to survive the winter without any shortages, even if an extreme cold spell hits. 

China abandoning its Covid-Zero approach earlier than expected will hand German businesses an extra boost.

Analysts surveyed by Bloomberg still see output shrinking 0.6% in 2023. The Kiel Institute for the World Economy, one of the country’s top think-tanks, is more bullish: In December, it revised its forecast for this year up to growth of 0.3%.

--With assistance from Kristian Siedenburg, Joel Rinneby and Alexander Weber.

(Updates with economist in fourth paragraph, statistics office chief starting in eighth.)

©2023 Bloomberg L.P.