A Reuters poll had predicted a month-on-month increase of 0.3%.

"Trade is no longer the strong resilient growth driver of the German economy that it used to be, but rather a drag," said Carsten Brzeski, global head of macroeconomics at ING.

Supply chain frictions, a more fragmented global economy and China increasingly being able to produce goods it previously bought from Germany were all factors weighing on exports in June, Brzeki added.

Imports fell 3.4% on the month, the statistics office data showed.

The foreign trade balance showed a surplus of 18.7 billion euros ($20.45 billion) in June, up from a slightly revised 14.6 billion euros the previous month.

Exports to European Union countries were up 1.3% on the month, while exports to the United States fell by 0.2% and exports to China and Russia were 5.9% and 2.3% lower, respectively, the office said.

"Since the end of the pandemic, global export volumes have been treading water," said Thomas Gitzel, chief economist at VP Bank Group, adding that the steep drop in exports to China in particular should be seen as a warning sign for the global economy.

Sentiment in the German export industry deteriorated slightly in July, a survey by the Ifo Institute showed last week.

"Demand from abroad is developing rather weakly," said Klaus Wohlrabe, head of surveys at Ifo. "This is also the result of restrictive monetary policy in the U.S. and Europe, the effects of which are gradually being felt."

The statistics office publishes more detailed economic data on its website.

($1 = 0.9146 euros)

(Reporting by Friederike Heine, editing by Miranda Murray, Maria Sheahan and Simon Cameron-Moore)