Its closely watched index rose 2.1 points from May to 38.5. This was better than expected by analysts questioned by Dow Jones Newswires, who had forecast
an index of 38.1.
"The financial market experts are sticking to their assessment: The German economy is likely to gain momentum in the second half of 2013," said ZEW president Clemens Fuest in a statement.
"The survey results indicate, however, that the economic recovery will proceed timidly. Almost half of respondents expect no significant economic impetus in the next half-year."
For the survey, ZEW questions analysts and institutional investors about their current assessment of the economic situation in Germany, as well as their expectations for the coming months.
The German economy narrowly scraped past a recession in the year's first quarter with 0.1 percent growth, after a contraction of 0.7 percent in the last quarter of 2012.
As much of the wider eurozone remains mired in recession, Germany's central bank, the Bundesbank, has predicted 0.3 percent economic growth for Germany for 2013 as a whole, which is expected to pick up to 1.5 percent growth next year.
On Monday it said that, after a weak start to the year, marked by a bitterly cold winter that delayed construction, it expected a strong pickup for the second quarter.
However, this would likely be followed by slower growth in the summer, it predicted, citing weaker industrial orders and export data.
The ZEW survey confirms that the German economy "might have bottomed out in early 2013," said Annalisa Piazza of Newedge Strategy.
"However, the pace of improvement remains extremely slow and -- in our view -- will force policy-makers to remain vigilant on the development on activity as downside risks continue to prevail."
James Howat of Capital Economics also said the second straight rise in the index "reinforces other data in pointing to an acceleration in the German economy."
However, he added that "the rise was down to improved expectations rather than any pick up in the current situation."
The index, which polls 257 analysts and institutional investors on how they assess the economic situation at the moment, in fact fell slightly for the third month running, to 8.6 points from 8.9 points in May.
Berenberg senior economist Christian Schulz said the cautious optimism for the coming six months comes as "the key tail risk, the euro crisis, has faded from the headlines since the problems in Cyprus and Italy have been dealt with."
However, he pointed out that the mood for now remains sombre, saying that "despite a string of solid recent hard data from industrial production, orders, retail sales and exports, investor's assessment of the current situation remained subdued."