The German economy picked up more steam than expected in the second quarter, driven by higher household and state spending, data showed on Tuesday, suggesting that Europe's biggest economy is powering ahead despite trade-related business uncertainties.

Gross domestic product expanded by 0.5 percent quarter-on-quarter, the Federal Statistics Office said. That compared with a Reuters forecast of 0.4 percent.

The office also revised up the quarterly growth rate for the first three months of the year to 0.4 percent from 0.3 percent.

"Despite all of the prophecies of doom, the upswing is not only alive; it's also kicking," Bankhaus Lampe economist Alexander Krueger said.

"For the time being, the upswing is unlikely to be stalled by the global trade dispute or overheating," Krueger said. But he added that the conflict with the United States over tariffs was clouding the outlook for the second half of the year.