Construction workers are silhouetted while standing on scaffolding at the construction site of the new headquarters of the  ECB during a guided media tour in Frankfurt
Construction workers are silhouetted while standing on scaffolding at the construction site of the new headquarters of the European Central Bank (ECB) during a guided media tour in Frankfurt, October 31, 2013. Reuters

Germany staved off the threat of recession in the third quarter with unexpected growth, data showed on Friday, but indicators pointed to even higher inflation driven by the painful shift away from Russian energy in Europe's biggest economy.

Gross domestic product increased by 0.3% compared to the previous quarter in seasonally adjusted terms, the federal statistics office said. A Reuters poll had forecast a 0.2% contraction.

"The German economy ... continued to hold its own despite difficult global economic conditions with the ongoing COVID pandemic, disrupted supply chains, rising prices and the war in Ukraine," the office said in a statement.

Economic output in the third quarter was driven primarily by private consumer spending, it added.

In the previous quarter, the German economy grew slightly by 0.1% quarter on quarter.

Year on year, GDP rose by 1.2% in the third quarter in seasonally adjusted terms, also beating analysts' forecast of 0.8% growth.

"The German economy kept its head above water. Or to put it another way: There's life in the old dog yet," VP Bank chief economic Thomas Gitzel said.

"However, the burdens for the coming quarters are immense," he said, adding that the Q3 data only postponed the arrival of a recession in Germany and the euro zone.

An energy stand-off with Russia has sent energy prices spiralling, pushing inflation to its highest rate in over 25 years in September at 10.9%, while fuelling concerns of a potential gas shortage this winter, even as gas storage facilities have been filled to near capacity.

The October inflation rate is to be announced later Friday, with analysts expecting no change.

However, inflation at state level has come in above that forecast.

In North Rhine Westphalia, Germany's most-populous state, the consumer price index surged to 11% in October compared to 10.1% the previous month, data showed.

The wealthy southern state of Bavaria also posted 11% inflation in October.

The Ifo economic institute said that the number of companies in Germany planning price increases eased somewhat in October, citing the results of its survey, but warned that the full effect of inflation has not yet reached consumers.

Earlier this week, Ifo forecast that the German economy would contract by 0.6% in the fourth quarter.

In its latest forecast, the government predicted growth of 1.4% this year and a 0.4% slump next year.

"The recession is now likely to hit in the winter, but it may not be as severe as initially feared," said LBBW bank's Jens-Oliver Niklasch.

He put the shock third-quarter growth down to the end of restrictions to mitigate the pandemic and relief measures introduced over the summer.

File photo of shoppers resting with their purchases in downtown Hanover
File photo of shoppers resting with their purchases in downtown Hanover June 19, 2012. Reuters
The skyline with its financial district is photographed during sunset as the spread of the coronavirus disease (COVID-19) continues in Frankfurt
The skyline with its financial district is photographed during sunset as the spread of the coronavirus disease (COVID-19) continues in Frankfurt, Germany, November 1, 2020, Reuters