Investor optimism about the German economy rose in February, according to a closely watched survey, raising hopes that the country may avoid a recession.

The latest ZEW institute's index rose to 48.2 points from 31.5 in January.

This marked the third monthly increase in a row and above the 36 points expected by market analysts.

The institute asked 272 investment industry analysts between February 4 and February 18 how they thought the economy would perform in the next six months.

Germany's economy shrank 0.6% in the fourth quarter, and another drop in the first three months of this year would put it in a recession, commonly defined as two consecutive quarters of economic contraction.

But many economists think the dip was only temporary and that the economy will quickly return to growth.

Fears have waned in recent months that a heavily indebted European country, such as Spain or Italy, would have trouble paying its debts - a situation that would have roiled financial markets and Europe.

Nonetheless, the euro zone economy is stuck in a recession and the European Central Bank expects it to shrink 0.3% for the year as a whole. A stronger German economy could help the euro zone on its expected path to recovery later in the year.

ZEW President Wolfgang Franz said the surveyed investors believe "the German economy faces less headwinds from the euro crisis than throughout the last months.

"If this situation remains unchanged during the next months, German business activity may pick up speed moderately," he said in a statement.

Analysts said that the survey result "adds to the positive signs for the economy in the early part of this year" but cautioned that the ZEW has not been as good a predictor of growth as business surveys such as the Ifo index, which comes out Friday.

They pointed out that the fourth quarter had been a "weak starting point," so it was not surprising that investors now seen things improving.