Chinese electric-vehicle sales are shifting back into high gear after a period of stagnant growth. Its homegrown EV makers are also turning into more formidable competitors: After struggling for decades to match foreign expertise in the internal combustion engine, China has a real chance to put foreign brands on the back foot in the electric era.

Warren Buffett-backed EV maker BYD on Friday reported a 54% increase in revenue for the first six months of this year, but its net profit recorded a 29% decline. Rising raw material prices and a chip shortage raised costs, but it probably also booked less profits from selling medical masks, compared with the same period last year. BYD built mask production lines in February 2020 and made millions of masks daily at one stage.

This year, the company’s focus is firmly back on more familiar turf. BYD sold around 200,000 new energy passenger cars—including plug-in hybrids—in the first seven months of this year, 28% higher than the same period in 2019. And it launched three new hybrids using its own technology called DM-i. Those have been selling well: plug-in hybrid sales year-to-date through July were 58% higher than the same period in 2019.

Chinese rivals Li Auto and Xpeng—focusing more on higher end segments—both reported record deliveries in July. New energy passenger vehicle sales in the first seven months of 2021 have more than doubled from two years earlier.

Penetration of new energy cars was 14.8% in July, compared with 5.8% in 2020, according to the China Passenger Car Association. Adoption of EVs is likely even higher in big cities as EVs benefit from looser license plate restrictions. China’s biggest cities limit the number of car plates to tackle congestion and pollution.

Favorable policies from some local governments after Covid-19 probably gave EV sales a lift, but that isn’t the whole story: Domestic car makers are making more appealing cars. One surprise winner is a $4,400 hatchback called Hongguang Mini EV, made by a joint venture of General Motors, Liuzhou Wuling Motors and state-owned SAIC Motor. The car is small, but packs decent performance at an affordable price. Tesla’s success aside, many top-selling EVs in China are made by domestic brands.

After a head start aided by generous subsidies, Chinese EV makers are now competing on quality and offering more differentiated products as government handouts ebb. The country also has a cluster of EV component suppliers, which helps to lower costs and spur the introduction of new designs. BYD, for example, said its new hybrids are available at a similar price to fuel-powered equivalents. The company’s own blade battery has helped lower costs.

The chip shortage could add some friction to China’s EV growth in the short run. The market is also getting crowded: Many aspirants won’t survive. But unlike in the internal combustion engine era, China stands a real chance of lapping the foreign competition.

Chinese automaker XPeng is betting that driving assistance features and other tech will be the key to winning new customers. WSJ travels to its research and development lab to see how its rivalry with Tesla could reshape how we drive. Photo: XPeng The Wall Street Journal Interactive Edition

Write to Jacky Wong at jacky.wong@wsj.com