Workers transport bags of soybean meal in a dockyard in Nantong in east China's Jiangsu province on Aug. 06, 2018.

China's trade surplus with the United States widened to a record in August even as the country's export growth slowed slightly, an outcome that could push President Donald Trump to turn up the heat on Beijing in their cantankerous trade dispute.

The politically sensitive surplus hit $31.05 billion in August, up from $28.09 billion in July, customs data showed on Saturday, surpassing the previous record set in June.

Over the first eight months of the year, China's surplus with its largest export market has risen nearly 15 percent, adding to tensions in the trade relationship between the world's two largest economies.

China's annual export growth in August moderated slightly to 9.8 percent, the data showed, the weakest rate since March but only slightly below recent trends.

The number missed analysts' forecasts that shipments from the world's largest exporter would rise 10.1 percent, slowing only slightly from 12.2 percent in July.

Even with U.S. tariffs targeting $50 billion of Chinese exports in effect for their first full month in August, China's exports to the United States still accelerated, growing 13.2 percent from a year earlier from 11.2 percent in July.

"There is still an impact from front-loading of exports, but the main reason (for still-solid export growth) is strong growth in the U.S. economy," said Zhang Yi, an economist at Zhonghai Shengrong Capital Management.

Zhang said the impact from U.S. tariffs on China's exports would likely be limited over the next few months.

China's imports from the United States grew only 2.7 percent in August, a slowdown from 11.1 percent in July.

The world's largest trading nation got off to a strong start this year, but its economic outlook is being clouded by the rapidly escalating U.S. trade dispute and cooling domestic demand.

Trump upped the ante on Friday, warning he was ready to slap tariffs on nearly all Chinese imports to the United States, threatening duties on another $267 billion of goods on top of $200 billion in imports primed for levies in coming days.

Washington has long criticized China's huge trade surplus with the United States and has demanded Beijing reduce it. Still, disagreements between the two major economic powers run deeper than just the trade balance and tensions remain over limits on U.S. firms' access to Chinese markets, intellectual property protection, technology transfers and investment.

Imports, a key gauge of the strength of China's domestic demand, grew 20 percent, beating forecasts. Analysts had expected growth of 18.7 percent, slowing from July's surprisingly high 27.3 percent.

That resulted in China posting a smaller overall trade surplus of $27.91 billion for the month. Analysts had expected the surplus would rise to $31.79 billion from $28.05 billion in July.

The surplus with the United States was larger than China's net surplus for the month, indicating China would be running a deficit if trade with the world's largest economy was excluded.