German exports beat forecasts with 4.5% growth in June compared with the previous month, data showed on Wednesday, as revised data showed Germany clinging on to its long-held trade surplus.

Meanwhile, imports increased on May by 0.2% in calendar- and seasonally-adjusted terms, the federal statistics office said.

Analysts polled by Reuters had pointed to a month-on-month increase of 1% in exports and 1.3% in imports.

In June, Germany had a seasonally adjusted trade surplus of 6.4 billion euros ($6.51 billion), the office reported, versus a forecast 2.7 billion euros.

This followed a surplus of 0.8 billion euros in May, revised up from a previously reported billion-euro deficit. ($1 = 0.9833 euros) (Writing by Rachel More; Editing by Maria Sheahan)