(Bloomberg) -- Xiaomi Corp.’s profit beat expectations as the world’s third-largest smartphone maker weathered a difficult quarter to close the year.

Smartphone shipments were down dramatically in the three months ended December, but the Beijing-based company still managed to record net income of 1.5 billion yuan ($218 million), better than the average analyst estimate of 800 million yuan. Revenue in the quarter was 66 billion yuan, the company said in a filing Friday. Analysts had predicted 65 billion yuan.

Once China’s biggest smartphone maker, Xiaomi trailed rivals from Honor to Vivo in domestic shipments. But the company’s efforts to diversify its products and investments helped it navigate a period affected by China’s Covid Zero restrictions and the disruption that was triggered when they were suddenly lifted.

The company is on track to achieve its goal of mass producing smart electric vehicles in the first half of 2024, it said in the filing. Xiaomi’s billionaire co-founder Lei Jun has made expanding to the burgeoning EV sector a priority and pledged billions of dollars of investment to the cause. The firm is in talks with Beijing Automotive Group Co. to collaborate on EV production as it races to fulfill a promise to make its own cars by 2024.

The holdup for Xiaomi’s automaking ambitions so far has been government approvals for the project. Xiaomi is one of the later would-be entrants to a Chinese EV sector already teeming with rivals, including better-established names BYD Co. and Nio Inc. Even without a head start, Lei — who has called electric cars the last startup endeavor of his career —  is betting on his company’s expertise in connected technologies and building loyal user communities. It spent 3.1 billion yuan in 2022 on smart EVs and related initiatives, the filing shows.

Xiaomi’s global smartphone shipments fell 26.3% in the fourth quarter — the steepest decline among all vendors — as demand withered across the world. Still, the company’s 33.2 million units shipped in the period was good enough to edge out local rivals to keep the title as the world’s No. 3 smartphone brand after Apple Inc. and Samsung Electronics Co., according to industry research firm IDC.

Lei has also pledged to investors to improve Xiaomi’s profitability while maintaining its business scale, a challenging task that would require improving margins on the handset business and higher profit from investments and the more lucrative internet services.

“It makes sense to shift focus to profitability after Xiaomi made some progress in higher-end markets,” Zhongtai International Securities analyst Angela Qin wrote in a report ahead of the earnings release. “The effort will help ease mounting pressure from the macro environment and emerging businesses.”

--With assistance from Alice Huang and Linda Lew.

©2023 Bloomberg L.P.