The average import price of crude oil stood at $47.26 per barrel in October, the highest level since August 2015, when it was $49.33, according to the Monthly Trade Highlights.
Good coming into the US from China, Mexico and the European Union all hit record levels, which boosted the trade gap to $48.7 billion - from $44.9 billion in September- and is the highest since President Trump took office in January.
Exports were unchanged at US$195.9 billion, but services exports were also the highest on record at US$65.6 billion.
The Trump administration has focused its trade policy efforts on lowering the trade deficit, arguing that the United States has been shafted in trade deals such as the North American Free Trade Agreement.
The trade deficit for the month was pushed by rising oil prices, as well as record imports from China ahead of the holiday shopping season, the Commerce Department said in its monthly report.
The agency says the shortfall was less than half the $3.4-billion deficit in September.
Trump took office on a nationalist economic agenda, pledging to bring down the trade deficit by canceling or renegotiating trade pacts and aggressively policing the export practices of major trading partners.
Exports of basic and industrial chemical, plastic and rubber products gained 12.4 per cent, while metal and nonmetallic mineral products increased 4.5 per cent.
The politically sensitive trade deficit in goods with China rose 1.7 percent to $35.2 billion from September to October and is up 7 percent this year to $309 billion. Imports of drilling and oilfield equipment climbed by $304 million, and imports of cellphones rose by $303 million.