Mr. Trump was continuing a drumbeat he began during his visit to Europe, when he told European Union officials that Germany was “very bad” on trade. But the president’s campaign against Germany, while accurate on the statistics, overlooks the benefits in the German-American trade relationship, and overstates Berlin’s ability to do much about it.
German companies employ roughly 700,000 people in the United States. Carmakers like BMW and Mercedes-Benz have huge American assembly plants, which export vehicles to China and Latin America. BMW’s factory in Spartanburg, S.C., is the largest single exporter, by dollar value, in the American automotive industry.
Mr. Trump’s latest offensive appeared to be in response to peppery remarks by Angela Merkel, the German chancellor, at a political rally in Munich on Sunday, when she said Europe could no longer rely on the United States as a partner. Europeans, she said, needed to “take our fate into our own hands.”
France also runs a substantial trade surplus with the United States, and it, like Germany, falls short of the military spending benchmark set by NATO, though in both cases by less than Germany. Yet Mr. Trump has spared France the kind of vitriol he has given the Germans — largely, officials say, because France spends more on its defense than Germany.
When he met France’s new president, Emmanuel Macron, for the first time in Brussels last week, he lavished praise on him for his election victory. “All over the world they’re talking about it,” he said. White House officials said Mr. Trump got along well with Mr. Macron in private, notwithstanding their much-photographed death grip of a handshake. Officials said Mr. Trump even told Mr. Macron he had been pulling for him in the election.
There is no such rapport between the flamboyant Mr. Trump and the brainy, button-down Ms. Merkel.
The two have a businesslike relationship, officials on both sides said. But Ms. Merkel, several officials said, has concluded that there is little prospect of closing the gap with Mr. Trump on issues like trade, Russia or the Paris climate accord, which Mr. Trump has threatened to leave. Her defiant tone on Sunday was driven in part by the fact that she is running for re-election and that Mr. Trump is deeply unpopular in Germany.
Whatever the motivation, it seemed to register with Mr. Trump. “I think it just stuck in his craw,” said Jackson Janes, president of the American Institute for Contemporary German Studies at Johns Hopkins University.
White House officials said it was the combination of Germany’s wealth and its meager contribution to NATO that singled it out for criticism. Germany spends only 1.2 percent of its gross domestic product on defense, compared with 1.8 percent for France. Both are below the 2 percent threshold that NATO has set for its members.
Germany’s trade surplus is a ripe target for Mr. Trump. It is mammoth — $64.8 billion in 2016 — and longstanding, and there is little evidence that Germany, which regards its export machine as a source of national pride, is inclined to do much to remedy it.
German officials typically tell their American counterparts that the surplus reflects the competitiveness of German goods, that Germany does not set its trade policy, and that it cannot control the value of the euro, since monetary policy is set by the European Central Bank, not Berlin.
Mr. Trump is not the first American leader to be rankled by imbalances with Germany. President Barack Obama’s economic advisers, Jacob J. Lew and Lawrence H. Summers, pushed German officials on these issues, with little success. But Mr. Trump is more acutely aware of the deficit because jobs and trade are such resonant issues with his voters.
John C. Kornblum, a former American ambassador to Germany, said the president’s views “seem to be a mixture of his own resentments from not being able to push his business deals through the E.U. as he wished; broad prejudices which have been building up in the American political class for some time on both NATO and trade; and the conviction of his economic advisers that the German trade balance is an evil, which causes many other problems from job losses to currency instability to loss of American exports.”
In his conversation with European Union leaders, Mr. Trump reportedly complained about the millions of cars that Germany sells in the United States, and threatened to stop them. Yet he has been an enthusiastic buyer of German luxury cars over the years.
After his Palm Beach wedding in 2005, Mr. Trump and his bride, Melania, jumped into a Mercedes Maybach limousine. He once bought a limited-edition silver Mercedes SLR McLaren roadster, with a supercharged AMG V8 engine, for $465,000. Mrs. Trump had her own Mercedes at the time.
German officials are in the meantime eager to avoid a wholesale rupture between Berlin and Washington. Ms. Merkel, they said, has spoken before of the need for Europeans to control their own fate and was still determined to develop a productive relationship with Mr. Trump.
“Precisely because trans-Atlantic relations are so important, it is imperative to speak honestly about the differences we have,” Peter Wittig, Germany’s ambassador to Washington, said. “Past meetings have revealed a number of such differences, for example in the area of climate change.”
At the White House, the message was much the same. Sean Spicer, the press secretary, said Mr. Trump would describe his relationship with Ms. Merkel as “fairly unbelievable” — meaning, apparently, that it is unbelievably good. Mr. Spicer finished the thought by adding, “They get along very well.”
He said Ms. Merkel’s call for Europe to go it alone actually vindicated Mr. Trump’s demand that Germany shoulder more responsibility for its defense. “The president is getting results,” he said. “More countries are stepping up their burden sharing. That is a good thing for them. It’s a good thing for NATO, and it’s a good thing for America.”
An earlier version of this article misstated the role of Condoleezza Rice in the spring of 2003. She was President George W. Bush’s national security adviser, not the secretary of state.