The skyrocketing US trade deficit last year hit the highest level in a decade, a resounding failure for President Donald Trump’s global trade offensive, government data showed on Wednesday.

And the US’ merchandise trade deficit – the main focus of Trump’s ire – surged to its highest level ever last year, as did the imbalance in goods trade with China, Mexico and the EU – even after Washington slapped tariffs on hundreds of billions in imports from its largest trading partners.

The bulging deficit numbers come as US and Chinese officials say they are nearing a breakthrough in talks to end their trade war. Beijing is expected to offer to make eye-catching purchases of US agricultural goods to cut the trade deficit and please Trump.

Trump has angrily described trade deficits as a defeat for the US, and aimed to erase them, but the Department of Commerce report was bristling with records as Americans snapped up mobile phones and companies invested in computer equipment last year.

The total US goods deficit surged 10.4 per cent to $891.3 billion, the highest level ever recorded.

Meanwhile, the overall trade deficit with the world, with services factored in, jumped 12.5 per cent to $621 billion as both imports and exports rose to their highest levels ever, according to the report. The deficit in 2017 was $552.3 billion.

In December alone, the total deficit also vaulted past expectations, surging 18.8 per cent and likely weighing on an economy which already was slowing at the close of the year.

“We expect the slowdown in global growth to continue to weigh on exports and industrial production,” Berenberg Capital Markets’ Mickey Levy wrote in a note to clients.

“In particular, economic weakness in China and Europe and trade-related uncertainties are dampening trade volumes.”

Last year, however, solid US growth, low unemployment and consumers’ thirst for foreign products drove imports of goods and services up 7.5 per cent to a record $3.1 trillion.

Exports also rose, but not enough to chip away at the imbalance. Sales abroad increased 6.3 per cent to $2.5 trillion last year, also the highest level ever.

And with the country on its way to becoming a net energy exporter, crude sales abroad more than doubled to $47 billion.

But soybean exports, a crucial crop across vast expanses of the country, fell 18 per cent for the year to $18.2 billion amid a Chinese boycott sparked by Trump’s trade war.

US purchases of foreign autos, computers and machinery, and consumer goods, as well as foods and animal feeds, also were the highest ever.

Imports of goods ($2.6 trillion) and services ($557.9 billion) reached new all-time highs, the report showed.

And even as Washington and Beijing have exchanged punitive tariffs on more than $360 billion in two-way trade, the US deficit with China expanded to an even larger $419.2 billion, a new record.

Trump rejects conventional economic views of trade, which hold that deficits are not always a negative for the economy as they can allow cheaper goods and services be made available to more people while promoting job creation.

The White House maintains that trade imbalances translate directly into thousands of job losses but while the tariffs protections help some companies, many others have struggled with higher prices and held off on investments amid the trade war. Some have even gone bankrupt or laid off workers as a result of the tariff battles.

While officials have projected optimism in recent weeks, details on a possible deal with China remain scarce.

The deficit with the EU, also in a trade standoff with Washington, also rose to a record $169.3 billion, while the gap with Mexico hit a high of $81.5 billion.

EU Trade Commissioner Cecilia Malmstrom is in Washington this week and due to meet later on Wednesday with US Trade Representative Robert Lighthizer as they prepare for formal negotiations.

At the same time, the US recorded surpluses with Britain and with South and Central America.