German economic growth slowed in the second quarter but less than expected given the impact of the Middle East war, according to provisional figures released on Thursday.

Output in the EU's top economy rose 0.2 percent compared with the first three months of the year, statistics office Destatis said, 0.1 percentage point higher than predicted by analysts polled by financial platform FactSet.

Destatis also revised first-quarter growth upward to 0.4 percent.

Growth was driven by higher exports, Destatis said, while consumption and investment were subdued.

"It's almost too good to be true: the German economy defied the fallout from the war in the Middle East," ING bank analyst Carsten Brzeski said.