The numbers: The U.S. trade deficit in December and for the full year both rose to the highest levels since 2008, complicating efforts by President Trump to fulfill his vow to reduce the gap.

The deficit in December rose 5.3% to $53.1 billion, the Commerce Department said Tuesday. Economists polled by MarketWatch had forecast a $52.2 billion gap.

Imports increased 2.5% to a record $256.5 billion in December. Exports edged up 1.8% to $203.4 billion, also a new high water mark.

In 2017, the U.S. trade gap leaped 12.1% to a nine-year high of $566 billion.

What happened: The large deficit in the fourth quarter prevented the U.S. from reaching 3% growth for the third quarter in row, a feat last accomplished in 2005.

Gross domestic product expanded 2.6% in the final three months of 2017, but the higher trade deficit shaved off 1.1 points. GDP is the official scorecard for the nation’s economy.

In 2017, the U.S imported more foreign-made cars, computers, cell phones and other consumer goods, much of which was produced in China.

The deficit in goods with China hit a record $375 billion. Imports from Mexico also reached a new peak.

Trump has targeted both countries with get-tough policies aimed at putting the U.S. on more equal footing, but progress has been virtually nonexistent so far.

Oil imports also surged, reflecting in part higher global petroleum prices.

While annual imports were the highest on record, the U.S. also boosted exports in 2017 to the second-highest level ever.

The U.S. shipped more oil and gas — an offshoot of the fracking revolution — as well as more autos, industrial equipment and passenger planes.

The big picture: The U.S. trade deficit widened in 2017 due to high oil prices and also to a strengthening economy. When Americans are more prosperous, they tend to buy more imported goods.

President Trump has promised to slash the trade deficit, and he’s taken a hard line with key trading partners such as Canada, Mexico and China, but it’s hard to see how he will succeed when so many presidents have failed. The last time the U.S. ran a surplus was in 1975.

Opinion:How the Federal Reserve will throttle stocks into 2019

The U.S. cannot control the international price of oil, for one thing, or discourage Americans from buying imported cars, computers or cell phones. In many cases U.S. companies no longer produce these goods.

Even if the White House puts in place stiffer trade rules that help the U.S. economy in the long run — a trade war could do the opposite — progress is unlikely to be easy or swift.

What they are saying? “Looking ahead, we expect the trade deficit to widen further in 2018,” said Gregory Daco, chief U.S. economist at Oxford Economics. A strong economy is likely to encourage consumers to buy more imported goods, he said.

Read:The stock market is plunging: Here’s what advisers say you should do