FRANKFURT — The economy in the euro zone officially shifted to contraction from stagnation in the second quarter of 2012, data showed on Tuesday, portending a recession for the region later in the year that would put even more pressure on political leaders struggling to keep the common currency intact.

Gross domestic product from April through June fell 0.2 percent from the previous quarter for the 17 countries that use the euro, according to preliminary estimates by Eurostat, the European Union’s statistics agency. In the previous quarter, growth was zero.

Economists said the decline in output, caused partly by government budget cutting, meant the euro zone was likely to enter recession, broadly defined as two consecutive quarters of shrinking output. Even the German economy, which has helped compensate for weakness in Italy and Spain, seemed to be losing momentum.

“Growth of the German economy was no longer strong enough to keep the total euro zone economy above the zero line,” Christoph Weil, an economist at Commerzbank, wrote in a note to clients.