President Trump falsely claimed the United States has a trade deficit with Canada, contradicting figures from his own administration.

Trump said the inaccurate statement on Wednesday at a fundraiser. The United States has a trade surplus with Canada, according to statistics from the Commerce Department's Bureau of Economic Analysis, which is a part of the executive branch.

A deficit would mean the United States bought more goods and services from Canada than Canada bought from the US. Conversely, a surplus means that Canada bought more goods and services from the United States than the other way around.

A deficit or surplus does not mean one country took money from another country, as Trump often portrays the number.

Trump doubled down on the claim this morning, tweeting: "We do have a Trade Deficit with Canada, as we do with almost all countries (some of them massive). P.M. Justin Trudeau of Canada, a very good guy, doesn't like saying that Canada has a Surplus vs. the U.S.(negotiating), but they do...they almost all do...and that's how I know!"

The US had a $2.8 billion trade surplus with Canada last year. It also had surpluses with Canada in 2015 and 2016, according to the Bureau of Economic Analysis figures (Page 39, Exhibit 20).

Related: Major US trading partners blast Trump's tariffs

Here's how the 2017 trade deficit is calculated:

The US had a deficit of $23.2 billion last year with Canada just in goods -- everything from toys to cars.

But the US had a surplus of $25.9 billion with Canada last year in services -- everything from tourism to technology to health care.

Subtract the goods deficit from the services surplus, and you get an overall US trade surplus of $2.7 billion with Canada.

White House Press Secretary Sarah Sanders said Thursday that Trump was referencing just trade in goods, as opposed to goods and services.

She defended Trump by citing statistics from the Census Bureau, which uses a different formula to count imports and exports than the Bureau of Economic Analysis uses.

According to the Census Bureau, the United States ran a $17.6 billion deficit with Canada, but it counts only goods.

Trump tends to mention only the goods deficit, which is misleading. The US economy today is much more driven by services: Hospitals, universities, tech companies, banks and so on. Manufacturing, an industry Trump focuses on, makes up about 10% of US economic output.

Globally, the United States has a trade deficit and that makes sense because the US economy is driven by consumer spending. Americans spending at stores and online make up about two-thirds of US economic activity.

Many economists say the trade deficit is not the right way to measure the fairness of trade deals, the trade balance or the health of the US economy. As the economy grew last year and unemployment fell, the trade deficit got bigger. During the financial crisis a decade ago, the trade deficit shrunk.

The United States can stomach such large trade deficits because foreign companies and governments take the money they get from US buyers and often reinvest that cash in US Treasury bonds. Although the US has a trade deficit, it still remains the top place for foreign investors to park their money. Those investments help to offset the trade deficit.