BEIJING (Reuters) - 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.

Containers are seen at the Yangshan Deep Water Port, part of the Shanghai Free Trade Zone, in Shanghai, China, February 13, 2017. REUTERS/Aly Song

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.

EXPORTS HOLDING UP

While no one predicted a sudden, sharp blow from U.S. tariffs, China’s official export data has been surprisingly resilient so far, with growth exceeding analysts’ expectations for five months in a row.

Chinese officials acknowledged Chinese exporters have been rushing out shipments to beat new U.S. tariffs, buoying the headline growth readings, while some companies such as steel mills are diversifying and selling more products to other countries.

Economists have noted that disruptions in supply chains are likely to be more company specific, and will take time to be reflected in broad economic data and corporate earnings reports.

However, anecdotal evidence of mounting trade damage on both sides of the Pacific is on the rise.

Official and private manufacturing surveys for China show global demand for Chinese goods is clearly on the wane, with export orders shrinking for months in a row.

“Risks have increased due to the negative impacts of China-U.S. trade friction. The impact on exports may gradually start to show up, with future export growth possible declining,” said Liu Xuezhi, an analyst with Bank of Communications.

Policymakers have shifted their focus in recent months to improving credit conditions and shoring up business confidence.

Beijing is ramping up spending on infrastructure projects to spur domestic demand and the central bank is tamping down borrowing costs and leaning on commercial banks to continue lending to struggling firms hit by trade troubles.

But such steps will take time to arrest the economy’s slide, and analysts expect the government to unveil more stimulus measures if business conditions continue to deteriorate.