Hong Kong (CNN Business) China's huge export industry just suffered its worst month in two years but still managed to rack up a record trade surplus with the United States in 2018 despite new tariffs.

The value of goods shipped from China to the rest of the world fell by more than 4% in December, compared to the same period a year ago, Chinese government data published Monday showed.

That represents the worst monthly performance for China's export sector in more than two years, and the first year-on-year decline since March 2018. Economists polled by Reuters had forecast that exports from China would rise slightly in December.

Despite last month's gloom, China for the second year running racked up a record trade surplus with the United States in 2018, according to Chinese data. The $323 billion gap in value between how much China sells to the United States and how much it buys from it has been at the heart of the trade dispute. President Donald Trump has previously said that trade with China is unfair

The United States had an even larger estimate of that gap, with the latest figures from the census bureau showing a $345 billion trade deficit with China in 2018.

Read More