On Friday, Nvidia overtook Apple to become the world’s most valuable company. This achievement came after a record-setting rise in Nvidia’s stock, driven by huge demand for its specialized artificial intelligence (AI) chips.

At one point, Nvidia’s market value reached $3.53 trillion, just above Apple’s $3.52 trillion, according to LSEG data. By the end of the day, Nvidia’s stock increased by 0.8%, valuing the company at $3.47 trillion. Meanwhile, Apple’s shares went up by 0.4%, giving it a market value of $3.52 trillion.

In June, Nvidia briefly held the top spot before Microsoft and Apple regained their positions. For months, these three tech giants have been close in market capitalization. Microsoft’s market value stood at $3.18 trillion, with its stock also rising by 0.8%.

Nvidia, based in Silicon Valley, is the leading supplier of processors used in AI computing. The company has greatly benefited as major players like Microsoft, Alphabet, and Meta Platforms race to dominate the emerging AI technology.

Originally known in the 1990s for designing processors for video games, Nvidia’s stock has risen about 18% in October. This surge followed OpenAI—the company behind ChatGPT—announcing a funding round of $6.6 billion.

On Friday, semiconductor stocks like Nvidia got a boost after Western Digital, a data storage maker, reported quarterly profits that beat analysts’ expectations. This news increased optimism about demand in data centers.

“More companies are now embracing artificial intelligence in their everyday tasks, and demand remains strong for Nvidia chips,” said Russ Mould, investment director at AJ Bell. “Nvidia is certainly in a sweet spot. As long as we avoid a big economic downturn in the United States, companies will continue to invest heavily in AI capabilities, creating a healthy tailwind for Nvidia.”

Nvidia’s shares hit a record high on Tuesday, building on gains from the previous week. This rise was supported by TSMC, the world’s largest contract chipmaker, reporting a better-than-expected 54% jump in quarterly profit due to soaring demand for AI chips.

Meanwhile, Apple is struggling with weak demand for its smartphones. iPhone sales in China slipped 0.3% in the third quarter, while sales of phones made by rival Huawei surged 42%.

Apple is set to report its quarterly results on Thursday. Analysts expect its revenue to climb 5.55% year over year to $94.5 billion, according to LSEG data. In comparison, analysts project Nvidia’s revenue to grow nearly 82% to $32.9 billion.

Shares of Nvidia, Apple, and Microsoft have a significant influence on the technology sector and the broader U.S. stock market. Together, they account for about one-fifth of the S&P 500 index’s weight.

Optimism about AI prospects, expectations that the Federal Reserve will significantly lower U.S. interest rates, and a positive start to the earnings season helped lift the S&P 500 to an all-time high last week.

Nvidia’s massive gains have increased the stock’s appeal among option traders. The company’s options have been among the most traded in recent months, according to data from options analytics provider Trade Alert.

The stock has surged nearly 190% so far this year, as the boom in generative AI led to a series of strong forecasts from Nvidia.

“The question is whether the revenue stream will last for a long time and whether it’s driven by investor emotion rather than any ability to prove or disprove the thesis that AI is overdone,” said Rick Meckler, partner at Cherry Lane Investments in New Vernon, New Jersey. “I think Nvidia knows that in the near term, their numbers are likely to be quite remarkable.”