Tesla Inc. shipments of China-made cars to the local market rose for a second straight month in September, even as general auto sales declined.

Elon Musk’s electric-vehicle maker reported domestic shipments of 52,153 units last month, following a near-50% jump in August. The automaker exported 3,853 vehicles from its Shanghai factory, China’s Passenger Car Association said on Tuesday. That meant Tesla’s total China shipments in September climbed 27% from August to 56,006.

The increase is in line with the broader trend for the automaker, which delivered a record 241,300 cars worldwide in the third quarter. At last week’s annual shareholder meeting, Musk said Tesla’s Shanghai factory is now outproducing the Fremont, California plant.

In China, the back-to-back gain in shipments suggests Tesla is moving on from a run of bad publicity, starting in April when a protest by a disgruntled owner at the Shanghai auto show went viral on social media. That was followed by a spate of crashes and regulatory scrutiny of safety and customer service issues, and more recently a driver successfully suing Tesla for fraud over his purchase of a second-hand Model S.

The drop in exports follows a pattern of Tesla prioritizing overseas shipments in the first half of the quarter, before ramping up local deliveries in the latter half of the period.

Overall retail sales of cars, sport utility vehicles and multipurpose vehicles and minivans fell 17% in September from a year earlier to 1.61 million units, the PCA data showed.

Deliveries of new-energy vehicles, which include EVs and plug-in hybrids, soared 202% from a year earlier to 334,000 units last month.

“We see strong sales momentum for new energy vehicles going forward,” PCA Secretary General Cui Dongshu said. “Exports to the EU have been spurring overseas shipments.”