A key survey of German business optimism rose sharply in February, adding to the evidence that the country will avoid a recession.

The Ifo index, released today, rose to 107.4 from 104.3 in January. It was the fourth monthly increase in a row and well above the 104.9 points expected by financial market analysts.

Germany's economy shrank 0.6% in the fourth quarter of 2012.

Another drop in the first three months of this year would meet the common definition of a recession as two quarters of shrinking economic output.

But many economists expect a rebound now that fears over the euro countries' debt crisis have eased.

Today's figure follows an in increase in the ZEW index based on surveys of investment analysts released earlier this week.

A German rebound could help the euro zone economy that use the euro work its way out of recession later this year.

Meanwhile, Germany's Federal Statistical Office posted a better-than-expected budget surplus in 2012 in spite of the contraction in the fourth quarter.

The office said in a release today that Germany posted a 0.2% surplus for 2012 under official EU debt criteria - better than the 0.1% predicted in January.

Analysts said the German economy's strengths were increasingly setting it apart from other euro zone countries that are trying to cut debt and improve growth.

Export slide drives contraction in German Q4 GDP

A plunge in exports drove a contraction in German gross domestic product (GDP) in the fourth quarter.

The fall offset support from domestic demand, and highlighted the vulnerability of Europe's largest economy to weakness in its euro zone trading partners.

Seasonally adjusted data from the Federal Statistics Office confirmed an earlier flash estimate showing German GDP shrank by 0.6% in the last three months of 2012 from the third quarter.

That was the biggest fall since the economy shrank by 4.1% at the start of 2009 and only the second contraction since the 2008/09 recession.The figures show that foreign trade deducted 0.8 percentage points from GDP while domestic demand added 0.2 percentage points.

Most economists said the German economy is on the road to recovery again and expect it to return to growth in the first quarter, thereby avoiding the second consecutive quarter of contraction that would put the country in a technical recession.

But while sentiment indicators from Germany now point to a solid first-quarter German rebound, the hard data suggest a milder recovery after the dismal fourth quarter.

The most recent data for exports, industrial orders and output point to only a slight uptick.

The breakdown of GDP data showed exports dropped by 2% in the fourth quarter while imports fell by 0.6%, boding ill for struggling euro zone states which had hoped to offload more of their goods on Germany, where rising wages, high employment and moderate inflation have boosted domestic demand.

Private consumption rose by 0.1% on the quarter and public consumption was up by 0.4%. Investment in equipment has been falling for more than a year now and dropped by 2% in the fourth quarter as firms spent less on machines, tools and vehicles, the Statistics Office said.

Many German companies are cutting costs, with steelmaker ThyssenKrupp recently saying it wants to cut €500m in costs over the next three years at its European steel operations.

Germany's economy nonetheless remains in good shape compared to struggling euro zone peers like Greece and Italy, where gross domestic product shrank by 6% and 0.9% respectively in the fourth quarter.

Surveys released this week have shown morale among German analysts and investors climbing to its highest level in nearly three years this month and private sector activity increasing for a third straight month.

Germany grew by a post-reunification record of 4.2% in 2010 and by some 3% in 2011 but growth slowed to 0.7% last year as exports suffered due to sagging demand in the euro zone and firms cutting back on investments.