The rise in domestic demand, however, overshadowed a drop in foreign trade, Destatis reported, saying the price-adjusted quarterly increase in imports was considerably larger than that of exports.
Germany's 0.6% growth figure was the same as the broader Eurozone.
"The same holds for the export sector, where a stronger euro, weaker-than-expected US growth and Brexit uncertainty could take some wind out of the sails without bringing exports to a halt", Brzeski said.
"The press release from the statistical office confirms our story that domestic demand was the main driver of growth in Q2 - mainly household and government spending - while net exports slowed", said Claus Vistesen at Pantheon Macroeconomics.More news: New Department of Defense Guidance "Cracks Down" on Drones
He said the European Central Bank's low interest rates were boosting the eurozone's largest economy.
Carsten Brzeski, analyst at ING Bank, said Germany's economic success just went "on and on and on" but he cautioned that exports could be dented by a stronger euro, weaker-than-expected U.S. growth and Brexit uncertainty.
However, it was a strong enough result to help push the annual rate of growth up to 2.1%, Germany's fast rate of growth since the first quarter of 2014.
Preliminary GDP data for Germany revealed growth of 0.6% in the June quarter, just shy of market forecasts of 0.7%.More news: Taylor Swift uses photo in sexual assault Lawsuit
The continued upswing will likely bolster Chancellor Angela Merkel ahead of the September 24 vote, with polls giving her conservatives a double-digit lead over their junior coalition partners, the Social Democrats.
Over the full year, the German government expects the economy to grow by 1.5 percent.
The latest flash estimate published by the European Statistics Office, Eurostat, on Wednesday showed 0.6 percent growth also for the wider 28-nation European Union. Outside the euro zone, Britain´s economic output grew by 0.3 percent on the quarter, edging up from 0.2 percent in the first three months.More news: Huddersfield beats Palace 3-0 on EPL debut