BEIJING (AP) — 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 U.S. goods rose 9 percent to $12.6 billion, down from 11.1 percent.

Chinese exports to the United States have stayed relatively strong despite being hit by punitive tariffs of up to 25 percent in a fight over American complaints about Beijing’s technology policy.

“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 month the Chinese trade surplus with the United States set a record.

Overall, China’s global 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.

China’s global exports are forecast to weaken due to cooling consumer demand.

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

Their 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.

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 U.S. market share.