Tesla Inc. and BYD Co. set sales records in the second quarter, likely widening their lead as the world’s top electric-car makers.

Elon Musk-led Tesla delivered 466,140 cars worldwide, beating Wall Street estimates. BYD, China’s top-selling car brand, posted its best-ever quarter, selling 700,244 fully electric and plug-in hybrid vehicles.

Tesla’s stock rose more than 6 percent in premarket U.S. trading, while BYD’s jumped as much as 5 percent in Hong Kong. Shares of EV battery suppliers Contemporary Amperex Technology Co. Ltd. and LG Energy Solution Ltd. also advanced.Tesla has vowed to push for more volume even at the expense of profitability, putting more pressure on legacy carmakers that haven’t kept pace on EVs and have ceded overall market share. Volkswagen AG last week announced new leadership for its Audi brand, which fell behind Tesla in the first quarter.

Analysts surveyed by Bloomberg had expected Tesla to deliver 448,350 cars in the last three months.

“It’s a big beat,” Ben Kallo, a Robert W. Baird analyst, said. “People were still bracing for another round of price cuts, and this big delivery number makes that less of a risk.

“The deliveries are the most ever in a quarter for Austin-based Tesla, and were up 83 percent from a year ago, when lockdowns hampered its operations in China. The company produced 13,560 more vehicles than it delivered in the quarter, after output exceeded sales by almost 18,000 cars in the first quarter.

“Everyone was worried about inventory build, and it looks like they’ve normalized,” Kallo said. “The delta between production and deliveries is shrinking, which is what Tesla said they would do.”

In addition to slashing prices across its lineup, Tesla has offered perks such as three months of free fast-charging in the U.S. and insurance-related subsidies in China to stoke sales. Some analysts have predicted price cuts will continue into next year.

Tesla doesn’t break out its quarterly delivery numbers by individual vehicles or regions. The Model 3 and Y accounted for 96 percent of sales last quarter. Tesla also makes the Model S and X. Tesla is the top EV maker in the U.S., but it’s facing stiff competition around the world from companies with fresher lineups. It newest vehicle — the Model Y — debuted in 2020.

The company has fallen well behind BYD in China, its No. 2 market after the U.S. Right after the quarter came to a close, Tesla cut prices of its premium models in China more than 4.5 percent.

Tesla will report second-quarter earnings on July 19.

BYD gained ground on Tesla in fully electric vehicle sales, almost doubling deliveries from a year ago to 352,163 units in the second quarter.

The Shenzhen-based company’s total sales soared 98 percent from a year ago. The company sold a record 251,685 new-energy vehicles in June.

Smaller Chinese upstart Li Auto Inc. posted a new monthly high of 32,575 deliveries, while Xpeng Inc. and Nio Inc. saw modest increases. Guangzhou Automotive Group Co.’s EV brand Aion stood out with another strong sales month, with 45,013 deliveries.

June sales “are showing new energy vehicle demand remains pretty strong” despite China’s economic drag, said Joanna Chen, a Bloomberg Intelligence autos and EV batteries analyst.