BEIJING—China's trade surplus with the United States widened to a record $34.1 billion in September as exports to the American market rose by 13 percent over a year earlier despite a worsening tariff war.

Exports to the United States rose to $46.7 billion, down from August's 13.4 percent growth, customs data showed Friday. Imports of American goods increased 9 percent to $12.6 billion, down from 11.1 percent.

Chinese exports to the United States have at least temporarily defied forecasts they would weaken after being hit by punitive tariffs of up to 25 percent in a fight over American complaints about Beijing's technology policy.

Get Breaking News Delivered to Your Inbox

"Exports continued to defy U.S. tariffs last month but imports struggled in the face of cooling domestic demand," said Julian Evans-Pritchard of Capital Economics in a report. "We expect both to soften in the coming quarters."

September marked the second straight record Chinese monthly trade surplus with the United States after August's $31 billion.

Export numbers have been buoyed by producers rushing to fill orders before American tariffs rose, but they also benefit from "robust U.S. demand" and a weaker Chinese currency, which makes their goods cheaper abroad, said Louis Kuijs of Oxford Economics in a report.

The yuan has lost nearly 10 percent of its value against the U.S. dollar this year. That prompted suggestions Beijing might weaken the exchange rate to help exporters, but that might hurt China's economy by encouraging an outflow of capital. The central bank has tightened controls on currency trading to head off further declines.

China's overall export growth accelerated, temporarily defying forecasts of a slowdown as the global economy and consumer demand cool.

Exports rose 14.5 percent over a year earlier to $226.7 billion, up from August's 12.2 percent growth. Imports grew 14.3 percent to $195 billion, down from the previous month's 20.9 percent rate.

Exports to the 28-nation European Union, China's biggest trading partner, rose 11.6 percent to $37.4 billion. The Chinese trade surplus with Europe was $12.7 billion.

Chinese leaders have rejected pressure to scale back plans for state-led development of global champions in robotics and other technologies.

Washington, Europe and other trading partners complain those violate Beijing's free-trade commitments and U.S. officials worry they might erode American industrial leadership. But communist leaders see their industry plans as the path to prosperity and global influence.

As tensions mounted, Beijing agreed in May to narrow its trade gap with the United States by purchasing more American soybeans, natural gas and other exports. Chinese leaders scrapped that deal after Trump's first tariff hikes hit.

Communist officials have ordered companies to stop buying American soybeans — the biggest U.S. export to China — and find alternative suppliers and export markets for other goods.

"Prospects for significant progress toward de-escalation of their trade conflict are low in the short term," said Kuijs.

Chinese exporters of lower-value goods such as handbags and surgical gloves say U.S. orders have fallen off. But sellers of factory machinery and other more advanced exports express confidence they can keep their market share.

With global growth cooling and U.S. threats of more tariff hikes, "the recent resilience of exports is unlikely to be sustained," said Evans-Pritchard.