BERLIN (Reuters) - The volume of Germany’s foreign trade hit a record in 2018, the Federal Statistics Office said, underlining how exposed Europe’s largest economy is to a global trading system that is under threat from protectionism and the threat of a trade war.

The annual figures -- showing that Germany had exported 1.3 trillion euros’ worth of goods and imported 1.1 trillion euros -- exceeded the previous record set in 2017. The trade surplus for the year narrowed slightly.

Germany, the continent’s economic motor, has boomed for a decade thanks to its role as a supplier of equipment to the world’s industrial nations. That makes it vulnerable to a possible trade war between China and the United States, which has taken a more protectionist stance under President Donald Trump.

But the latest monthly figures, showing unexpected month-on-month growth in both exports and imports, appeared to snap a long run of gloomy economic indicators, possibly indicating that the economy’s long-expected slowdown may yet be postponed.

Seasonally adjusted exports rose 1.5 percent month-on-month - up from a 0.4 percent fall in the previous month, and confounding forecasts of 0.2 percent growth. Imports meanwhile rose 1.2 percent, compared to a 1.6 percent decline in the previous month.

That meant the trade surplus widened to 19.4 billion euros from 18.4 billion euros the month before.