After surging oil prices propelled shares of the world's largest crude exporter to record highs, Saudi Aramco has surpassed Apple as the world's most valuable company, while a broader tech stock sell-off weighs on the iPhone manufacturer.

It's the first time Saudi Aramco has reclaimed the top rank since 2020, and it comes after a year-long sell-off in technology stocks.

Aramco is now worth about $2.43 trillion, compared with Apple's $2.37 trillion, according to data from Refinitiv.

Market capitalizations fluctuate frequently: earlier this year, Apple hit the $3 trillion mark, becoming the first to do so and making it by far the most valuable company on the planet.

Aramco at one point also held that mantle after a historic initial public offering in 2019, which propelled its valuation to $2 trillion.

But the latest market moves point to how the outlook for energy and tech producers has shifted lately.

This year, oil prices have soared to record highs, particularly on concerns about disruptions of supply from Russia since its invasion of Ukraine. Brent crude, the global benchmark, has climbed about 36% so far this year and was the last trading at $106.2 a barrel. That has buoyed players like Saudi Aramco, whose shares are up 27% so far this year.

Meanwhile, Apple's stock has fallen more than 17% since January.

The iPhone maker has recently been weighed down by major supply chain headaches, particularly in China, where several of its suppliers' factories have been temporarily caught in the country's Covid lockdowns.

Last month, Apple warned of huge losses related to the ongoing situation, saying that production and logistics issues could hit its sales by as much as $4 billion to $8 billion this quarter.