Germany's trade surplus climbed to a record high in 2016, official data showed on Thursday, days after U.S. President Donald Trump's top trade adviser accused Berlin of exploiting a "grossly undervalued" euro to its advantage.

The surplus is likely to worsen tension between Washington and Berlin, which is trying to safeguard global free trade this year during its presidency of the Group of 20 leading economies, adopting the motto "Shaping an Interconnected World".

Germany's trade surplus for 2016 rose to 252.9 billion euros ($270.05 billion), surpassing the previous high of 244.3 billion euros in 2015, the Federal Statistics Office said.

"The record surplus will continue to fuel the conflict with the USA and within the EU," said Marcel Fratzscher, head of the DIW economic institute, an advocate of stronger investment in Germany.

"European neighbors would benefit from stronger investment in Germany," he said. "Germany, however, would profit first and foremost, as the investment gap and the resulting excessive trade surpluses are detrimental to the domestic economy."

Last week, U.S. President Donald Trump's top trade adviser said Germany was using a "grossly undervalued" euro to gain advantage over the United States and its European partners.