The two leaders spoke by telephone and said in a statement issued in Berlin that they would "together fight for free trade and open markets".
Finance ministers from the world's top economies are gathering in Germany from Friday as fears grow that US President Donald Trump could upend the global economic order with his "America First" policy challenging open markets.
Meanwhile Merkel is set to hold her first meeting with Trump in Washington on Friday, on a trip on which she will be accompanied by a top-rung German business delegation.
Within two months of moving into the White House, Trump has already torn up the trans-Pacific free trade pact, threatened punitive tariffs against multinationals with factories outside the United States and attacked "currency manipulation" by export giant China.
White House economic advisor Peter Navarro in January accused Germany and China of taking advantage of weak currencies to build a trade surplus with the United States.
In the statement, Merkel and Xi "agreed to maintain their close cooperation, in particular in the context of the German G20 presidency" this year, which will include a July summit in Hamburg.
And on the eve of the finance ministers' meeting, Germany's Wolfgang Schöuble was set to host US counterpart Steven Mnuchin later Thursday for their first official talks.
A senior Treasury official said Mnuchin would press G20 partners to fulfil their commitments on exchange rates.
A statement is produced at the end of the two-day meeting that has in past sessions consistently committed signatories to rejecting protectionism and refraining from competitive currency devaluations.
But fears are running high that this year's communique may have to sidestep the issue.
Business daily Handelsblatt reported that Germany was trying to strike a compromise with a "list of principles" but had yet to get all sides on board.
The conversation between Merkel and Xi also covered "market conditions for expanding electromobility in China" to allow the Germany auto industry "to continue to be successful in the Chinese market", the statement by Merkel's spokesman Steffen Seibert said.