* Industrial output down 0.9 pct m/m in June
* Weaker than expected 0.5 pct fall
* Trade surplus narrows as exports remain flat
* Industrial output up 0.4 pct in Q2
* Economy seen shifting into higher gear (Adds more data, analysts and background)
BERLIN, Aug 7 (Reuters) - German industrial output fell more than expected in June after jumping the previous month, data showed on Tuesday, suggesting that Europe's largest economy ended the second quarter weaker as exports remained flat.
But for the quarter as a whole, industrial output rose by 0.4 percent, the economy ministry said. That means manufacturing contributed to an expected acceleration in gross domestic product growth during the April-June period.
The release followed data on Monday that showed German industrial orders dropped in June by the most in nearly a year and a half, suggesting that trade tensions caused by U.S. President Donald Trump might limit growth.
"June's industrial production and trade figures suggest that the previously booming German economy is already feeling the effects of trade tensions," said Jennifer McKeown at London-based Capital Economics.
"But with the domestic economy in good shape and given the recent ceasefire in the tariff war, we expect only a modest slowdown in German growth."
The Economy Ministry said on Tuesday industrial output fell 0.9 percent on the month in June, missing a Reuters forecast for a drop of 0.5 percent. That came after a downwardly revised rise of 2.4 percent in May.
A breakdown of the June data showed manufacturing fell by 0.8 percent and construction dropped by 3.2 percent. But energy production jumped by 2.9 percent.
"That's not a great result, but it could have been worse," Bankhaus Lampe economist Alexander Krueger said. "In contrast to the first quarter, industrial production supported growth in the second quarter."
The Federal Statistics Office will publish preliminary gross domestic product growth data for the second quarter next Tuesday.
Analysts polled by Reuters on average expect the quarterly growth rate to edge up to 0.4 percent from 0.3 percent in the first quarter, driven by private consumption and construction.
The German economy expanded by a robust 2.5 percent in 2017 and most analysts expect only a moderate slowdown to around 2 percent this year.
The Federal Statistics Office said in a separate statement that seasonally adjusted exports were unchanged on the month in June while imports rose by 1.2 percent.
The seasonally adjusted trade surplus narrowed to 19.3 billion euros from an upwardly revised 20.4 billion euros ($23.60 billion) in May.
In the first half of the year, the trade surplus was nearly unchanged at 121.5 billion euros after 121.3 billion euros in the first six months of the previous year, unadjusted data showed.
Trump has agreed to refrain from imposing tariffs on cars imported from the EU while the two sides negotiated to cut other trade barriers.
The decision, reached in talks between Trump and European Commission President Jean-Claude Juncker in Washington last month, eased fears of a transatlantic trade war.
($1 = 0.8642 euros) (Reporting by Michael Nienaber Editing by Michelle Martin and Raissa Kasolowsky)