BEIJING—China’s trade surplus with the U.S. hit a record last year, as robust American demand for Chinese goods undercut the Trump administration’s tariff offensive aimed at narrowing the countries’ lopsided trade gap.

China recorded $323.32 billion in surplus with the U.S. in 2018, representing a 17% jump from the figure in the previous year, according to Chinese government trade data released Monday.

Abetting...