Correction: An earlier version of this editorial incorrectly reported Germany’s trade surplus. The correct figure for last year was 8.25 percent, down from 8.5 percent in 2015.

PERHAPS THE best that can be said about the meeting between President Trump and German Chancellor Angela Merkel last week, and the parallel session of the Group of 20 finance ministers in Germany over the weekend, is that everyone got through them. German-American relations are at a low ebb, in part due to Mr. Trump’s excoriation of German trade surpluses, which his aides have attributed to currency manipulation and other purportedly unfair practices. Mr. Trump compounded the bad atmosphere by blasting Germany on Twitter for allegedly owing the United States and the Atlantic alliance “vast” sums for its defense.

Before this gets totally out of hand, it is probably worth reviewing what is legitimate about Mr. Trump’s critique and what is not. Ms. Merkel’s own defense minister has acknowledged that Germany can and should do more to meet the NATO defense spending target of 2 percent of economic output per year. That’s true even if it is bogus, legally and economically, to speak of a German debt to the United States. Why Mr. Trump would have spread his mistaken concept on Twitter, in bullying language to boot, after the Germans had spoken in conciliatory terms on this point is no clearer than the rationale for any of his other outbursts on social media.

On the matter of trade, however, Germany has been less inclined to acknowledge the reasonable views of critics — even when the questions emanate from far cooler heads than the Trump administration. Indeed, it was the Obama administration Treasury Department that first took aim at Berlin’s chronic huge surpluses (about 8.25 percent of gross domestic product last year) in its October 2013 semiannual report on international trade, stopping just short of a direct currency-manipulation accusation against Germany. Nobel Prize-winning economist Paul Krugman, the European Commission and the International Monetary Fund have all repeatedly called upon Germany to import more and export less — on the grounds that this would help its European partners find more markets for their goods and grow out of their respective debt crises.

Germany has increased reliance on growth through domestic demand since the 2013 Obama administration report — slightly. One cause of greater spending on goods and services, as it happens, was Ms. Merkel’s decision to house, feed and educate nearly 1 million asylum seekers in 2015 — something Mr. Trump might have considered before condemning her during his campaign. But there is more, much more, that Germany could contribute to the cause of intra-European and global economic rebalancing, in particular by investing in infrastructure. Berlin nevertheless resists, fiercely, out of a stubborn, almost dogmatic commitment to budget-balancing and trade surpluses.

Frustrating as U.S.-German dealings on this point were for his predecessor, Mr. Trump’s attempt to bludgeon Berlin into submission has proved counterproductive. Even if it were not an election year, Ms. Merkel could not capitulate to an American president who is profoundly unpopular among her voters. Instead, she is portraying Germany as a defender of free trade and trying to rally Japan and China to the cause, a job made easier by Mr. Trump’s embrace of openly protectionist thinking. Sometimes in international politics, what counts is not the argument you make, but how you make it, and Ms. Merkel is proceeding accordingly. Smart lady.