The numbers showed Europe's biggest economy grew slightly by 0.2 percent in the third quarter of this year, federal statistics agency Destatis, with the news surprising experts.
Output was boosted by increased government and household spending, Destatis said in the preliminary data.
Before the figures were announced, the economy ministry said it had expected "a renewed slight decline" in the third quarter of this year.
It wasn't all good news however, as Destatis revised downwards its figure for the second quarter, saying the economy contracted by 0.3 percent instead of the previous estimate of a 0.1 percent decline.
The third-quarter figure was "a positive surprise" after months of gloomy indicators, said LBBW analyst Elmar Voelker.
While it was "too early to speak of a positive trend reversal", he said, it was "encouraging that private consumption is showing the first signs of recovery - thanks to falling inflation".
A technical recession is defined as two consecutive quarters of contraction.
"The German economy is unlikely to have emerged from its weak phase in the third quarter," the ministry said this month.
Analysts surveyed by financial data supplier FactSet were narrowly more upbeat, predicting a quarter-on-quarter stagnation.
Other major European economies were also publishing third-quarter GDP data Wednesday, with Germany now likely to boost the eurozone figure.
France's economy expanded by 0.4 percent thanks in large part to the Olympic Games, while Spanish GDP expanded 0.8 percent.
Traditionally a European growth engine, Germany has been hit hard by elevated energy costs after Russia's invasion of Ukraine, sluggish domestic consumption following a period of high inflation and cooling export demand.
READ ALSO: Why is Germany's economy so sluggish and what does it mean for you?
Despite the slight growth, headwinds have taken their toll on the country's crucial industrial sector, which accounts for around 20 percent of German GDP.
"The manufacturing sector is running out of orders," the BDI federation of German industries said in its latest report.
The BDI now sees factory output falling by three percent year-on-year in 2024, noting that this would be "the third consecutive drop".
The downturn has been particularly visible in Germany's flagship auto sector.
Volkswagen is considering closing at least three German plants and axing tens of thousands of jobs, labour leaders told employees this week, as Europe's biggest car manufacturer confronts stiff Chinese competition especially in electric vehicles.

It posted Wednesday a 64-percent drop in third-quarter net profit to 1.58 billion euros ($1.7 billion), as it struggles with high costs and slowing sales in China.
Volkswagen, BMW and Mercedes-Benz all lowered their annual outlook in September, citing falling Chinese demand.
READ ALSO: Volkswagen set to close at least three factories and cut tens of thousands of jobs
Government under pressure
Long-standing structural challenges are adding to Germany's woes, including complex bureaucracy, under-investment in infrastructure, an ageing workforce and a costly green energy transition.
Pressure is mounting on Chancellor Olaf Scholz to take action, but his fragile three-party coalition is at odds over how best to turn the economic tide.
READ ALSO: Can political leaders help steer Germany out of its economic slump?
Economy Minister Robert Habeck, from the Greens party, last week proposed a multi-billion-euro investment bonanza to help German business.
But the idea was shot down by hawkish Finance Minister Christian Lindner.
Lindner, from the liberal FDP, is a staunch defender of Germany's constitutionally enshrined debt limits and has resisted calls from other coalition members to loosen the rules.
The International Monetary Fund has waded in on the debate, with its European head Alfred Kammer on Tuesday saying Germany needed structural reforms as well as public infrastructure investments.
To achieve this, he told the Sueddeutsche newspaper, "the debt brake can be relaxed".
The German government has previously said it believes a recovery will come in 2025, when easing inflation and higher wages are expected to boost consumption.
German inflation slowed to 1.6 percent in September, the lowest level since 2021. October's inflation figure is due later on Wednesday.
Unemployment meanwhile was stable in October at 6.1 percent, separate data showed.
By Michelle FITZPATRICK with reporting by Rachel LoxtonÂ
Comments