If you want to think of it in terms of winners and losers, in fact, you could justifiably reverse Mr. Trump’s preferred framing: “Those losers in Mexico gave us $58 billion more stuff than we gave them last year. Ha, ha, ha. We’re winners.”

But don’t trade deficits mean fewer jobs?

Maybe.

It is true that a trade deficit subtracts from a country’s gross domestic product. G.D.P. measures the value of goods and services produced within a country’s borders, so when a country is selling less stuff abroad than it buys from abroad, the country is making less stuff, and as a result there are fewer jobs. This piece of the Trump theory of trade is true.

But when a country runs a trade deficit, as the United States does, there is a countervailing force. Think back to our pretend countries. BananaLand has a $1 million trade deficit with CarNation. But that means that car producers in CarNation are sitting on an extra $1 million a year in income.

Something has to happen with that $1 million, and both of the two options have consequences.

One option is to keep that money at home. But keeping that money inside CarNation will push the value of its currency upward. And as its currency goes up, cars will become more expensive in BananaLand — causing people there to buy fewer of them until eventually the trade deficit is eliminated.

If CarNation doesn’t want its currency to rise, it has to take that $1 million trade surplus and plow it back into BananaLand. There are different ways it could do that. People in CarNation could buy stocks or bonds in BananaLand, or companies in CarNation could invest in factories in BananaLand, or the government of CarNation could buy assets directly.

The choice is stark: A country running a trade surplus must either let its currency rise or let money flow back to its trading partners.

This isn’t just an abstraction. It’s what has happened between the United States and China for the last couple of decades. China has had consistent trade surpluses, but it did not want its currency to rise in a way that would undermine its exporters. So money has flowed from China into the United States — both from the Chinese government’s purchases of United States Treasury bonds and more recently in the form of direct investment from Chinese companies into the United States.