The euro zone has snapped out of an 18-month recession, showing new signs of economic life during the second quarter of the year, according to data released Wednesday.

The collective economy of the 17 nations that share the euro currency grew by 0.3 percent compared with the previous quarter, according to Eurostat, the euro zone’s statistics agency. In the first quarter, the zone’s economies contracted by 0.3 percent.

The meager growthwas higher than the 0.2 percent analysts were anticipating. But the pace was uneven, with weaker countries continuing to experience economic contraction, even as the recovery strengthened in Germany and France. And some economists warned that the region still faces significant hurdles, including record-high unemployment and crippling debt levels in some countries.

Olli Rehn, the European Union’s commissioner for the economy, said in a statement the numbers are “encouraging” and that “the European economy is gradually gaining momentum.”

The recovery was strongest in the region’s largest economies, Germany and France, where the gross domestic product rose 0.7 percent and 0.5 percent, respectively. In Germany, the uptick was primarily due to a pickup in domestic demand.

The biggest surprise, however, was France, which emerged from its recession during the second quarter and grew faster than analysts were expecting as domestic consumption rose. That increase in its GDP was the largest for the nation in more than two years.

Analysts were quick to note that the economy continues to contract in several euro-zone countries.

The economies of Italy and Spain slowed moderately, by 0.2 percent and 0.1 percent, respectively. The Dutch economy also contracted by 0.2 percent. The economy of Cyprus, which was forced to seek an international bailout in March, shrunk by 1.4 percent. No data for Greece or Ireland were available, but annualized figures for Greece show it contracted 4.6 percent compared with the same period last year.

A notable exception was Portugal, which saw an increase in its GDP for the first time since 2010. Portugal’s economy grew 1.1 percent, driven by a sharp acceleration in exports and beating analysts’ expectations.

Portugal’s growth might prove the strongest among the developed countries of the international Organization for Economic Cooperation and Development, said Christian Schulz, senior economist at Germany’s Berenberg Bank. Some economic data are “indicating an end of recession in most of the [euro zone] periphery,” he said.

Yet despite the upbeat news, analysts remain cautious about the euro zone’s economic prospects going forward. “Caution is warranted as risks abound,” said Schulz.

The Economist Intelligence Unit expects subdued growth in the region in the second half of the year and a slow and gradual recovery in 2014. In a note Wednesday, the research group said domestic demand in the weakest euro-zone countries will remain constrained by high unemployment, fiscal austerity, high debt levels and tight credit conditions for small companies.

Against this backdrop, any economic recovery for the weakest euro zone members will depend on external demand for their products and the pace of global economic growth.

Rehn, too, cautioned against overconfidence, noting that the return to overall growth hides important weaknesses in some countries. “A number of member states still have unacceptably high unemployment rates; the implementation of essential, but difficult, reforms across the E.U. is still in its early stages. So there is still a very long way to go,” he said.