Ericsson is competing with Huawei in the global rollout of 5G technology.

Swedish telecoms giant Ericsson said Tuesday its net profit soared in 2021, with a better-than-expected performance in the fourth quarter despite losing ground in the key Chinese market.

The world's number two telecoms equipment maker is competing with China's Huawei in the global rollout of ultra-fast 5G mobile phone networks.

But Ericsson's sales in China have taken a major hit as it has faced reprisals there since Sweden banned Huawei and another Chinese firm, ZTE, from the European country's 5G network in 2020 for security reasons.

Despite the challenges, the Swedish company expects to reach its long-term profitability target sooner than previously estimated.

"Our strategy to invest in technology leadership and grow in our core business underpinned a robust financial performance in 2021 and ensured a good Q4 for Ericsson overall," chief executive Borje Ekholm said in a statement.

Net profit soared by 30 percent last year to 23 billion kronor ($2.5 billion, 2.2 billion euros).

Sales were stable at 232.3 billion kronor in 2021.

Its profit surged by 41 percent in the to 10.1 billion kronor, while sales rose by three percent at 71.3 billion kronor.

Analysts surveyed by Bloomberg had expected a quarterly retreating to 7.1 billion kronor.

In mainland China, sales plunged by 7.7 billion kronor last year, but Ericsson made up those losses by gaining ground in other markets.

In the race to dominate the world's 5G rollout, the Swedish equipment maker has made headway especially in North America, but also in Europe and Latin America.

In November, the company announced the acquisition of US-based Vonage, a specialist in cloud-based communications solutions in November last year for $6.2 billion, the largest acquisition in Ericsson's recent history.

While profits are up, Ericsson warned that intellectual property revenues in the first quarter would be down as it flagged a new legal battle with US tech giant Apple over patents, with competing complaints from the companies.