The gross domestic product (GDP) of the world's third-largest economy fell by 0.5 percent compared to the first quarter of 2008, the Federal Statistical Office said in a statement.
“The economic trend in the second quarter was characterized by decreasing household final consumption expenditure and smaller fixed capital formation,” the statement said.
The last time the German economy shrank was in the third quarter of 2004, as GDP contracted 0.2 percent. The Federal Statistical Office also revised 2008 first quarter GDP growth lower to an increase of 1.3 percent instead of 1.5 percent as first reported.
"We expected the weakening of growth in the second quarter," German Economy Minnister Michael Glos said after the release of the data. Despite the slowdown he said the German economy was now more competitive and the government was sticking to its "consciously cautious" forecast of 1.7 percent growth for 2008.
Taken as a whole, the German economy expanded 0.8 percent in the first six months. But economists are not so sure Germany will hit the government target for this year, with Martin Lück at UBS saying that the second quarter result "means more than just a correction from an unusually strong first quarter."
"Recent leading indicators ... have all pointed to a sharp slowdown in the second half. Manufacturing output has slowed sharply in recent months, indicating that the prolonged period in which the German industry appeared to be immune against the toxic mix of global slowdown, strong currency and very high oil prices has now come to an end," Lück said.
"With growth collapsing in Germany's most important trading partner countries ... we think recession is now also possible in Germany," Lück said.
Commerzbank's Jörg Krämer was also downbeat, saying the data "point to real economic difficulties ahead."
"The leading indicators have meanwhile fallen sharply, suggesting that a hard landing is on the cards -- although not as severe as in Spain or the UK," Krämer said.
Figures also out on Thursday confirmed that inflation in Germany hit a 15-year-high of 3.3 percent high in July, driven by rampant energy and food prices.
The two sets of data illustrate the dilemma facing the European Central Bank.
In order to keep a lid on inflation - which reached a record 4.0 percent in July in the euro zone - it cannot risk lowering interest rates. But high borrowing costs in turn put the brakes on growth.