China's red hot smartphone market has gone cold.

Smartphone shipments in China have suffered their biggest decline ever, plummeting more than 21% in the first quarter of 2018 compared with the same period last year, according to a new report from research firm Canalys.

Chinese consumers bought just 91 million phones in the first three months of this year. The last time the number was that low was in the fourth quarter of 2013.

Canalys had forecast the decline but didn't "foresee the drop would be so huge," said Canalys analyst Mo Jia.

The report comes as Samsung, the world's largest smartphone maker, boasted record quarterly earnings on Thursday, reporting an increase of 52% over the previous year. But the South Korean company also warned that overall "sluggish demand" for smartphones would drag down future earnings.

Related: Who needs the US? Huawei profits jump 28%

That slowdown has already hit Samsung (SSNLF) sales in China, the world's largest smartphone market. The company sold just 2 million devices in China in the first quarter of 2018, down more than 50% compared to the same period last year, according to Jia.

Apple (AAPL) also lost ground in China, slipping from fourth to fifth place in the market, Canalys said. The research firm declined to say how many devices Apple sold in China, but Jia said the company suffered a "significant decline" in shipments from the previous quarter.

Apple usually has a drop between the fourth quarter of one year and the first quarter of the next, but this decline was bigger than expected, said Jia.

"Apple has a strong image, but their product and innovation is restricted to the very high-priced iPhone X ... most Chinese cannot afford that price so they switch to Huawei or Oppo," said Jia.

Related: China's Xiaomi tightens grip on India's smartphone market

Huawei was one of only two companies to buck the declining trend. The Chinese smartphone maker saw sales climb 2%. It remains the top smartphone seller in China, followed by local rivals Oppo, Vivo and Xiaomi, according to Canalys.

Xiaomi was the only company to post double digit growth, with sales up 37%, partly reflecting a lackluster performance in 2017, said Jia.

Canalys predicts growth in the smartphone market will pick up again in the next three months, thanks to new flagship phones from Oppo and Vivo. But that will likely be the only bright spot for the year.

"We forecast ... the Chinese market in 2018 will have an overall decline," said Jia.

That would mean back-to-back years of contraction. Annual smartphone sales dipped for the first time ever last year, falling 4% to 459 million phones.

Correction: An earlier version of this article misstated Apple's position in the Chinese market.