Xiaomi Corp. said Thursday that it swung to a net loss for the first quarter due to higher costs and unfavorable fair-value changes on investments.

The Chinese consumer-electronics company 1810, -4.97% posted a first-quarter loss of 530.7 million Chinese yuan ($78.6 million), compared with net profit of CNY7.79 billion a year earlier.

Revenue fell to CNY73.35 billion from CNY76.88 billion a year ago.

Xiaomi said research and development costs rose 16% to CNY3.5 billion during the quarter, while selling and marketing expenses increased 26%, partly due to higher overseas shipping logistics costs. Fair-value changes on investments swung to a loss of CNY3.6 billion from a gain of CNY2.1 billion in the first quarter last year.

The continued supply shortage of key components and a resurgence of Covid-19 variants also negatively affected the overall demand and supply situation of the smartphone market in the first quarter, Xiaomi said.

Write to Yi Wei Wong at yiwei.wong@wsj.com