(Bloomberg) -- Microsoft Corp. briefly achieved a historic $3 trillion market valuation on Wednesday, in the latest example of how optimism over artificial intelligence has fueled a seemingly unstoppable advance in the software giant.

The stock rose as much as 1.7% to $405.63, taking its market capitalization just over $3 trillion during market hours. However, it closed up just 0.9%, ending at a record but with a valuation of $2.99 trillion.

While the threshold wasn’t held, it cements Microsoft’s status as one of the largest public stocks. It briefly surpassed Apple Inc. — which last year became the first company to hit $3 trillion — but subsequently dropped back below the iPhone maker in value. Apple closed with a market valuation of $3.01 trillion.

“There is a huge push toward generative AI, and Microsoft is holding a tremendous number of the cards with its offerings,” said Ted Mortonson, technology desk sector strategist at Baird. “To see a company of this size with this kind of growth is pretty amazing, and I think that so long as we continue to see this kind of growth, the stock will continue to rip.”

The Redmond, Washington-based company is one of the so-called Magnificent 7 that fueled the market’s advance over 2023, gaining about 57%. The advance continued into this year, with a 7.1% rise that exceeds the 4% gain of the Nasdaq 100 Index. Microsoft accounts for 7.25% of the S&P 500 Index.

Read more: BofA’s Hartnett Says Growth, AI Stocks Are Favorites Again

Much of the gain reflects investor enthusiasm over AI and its potential to accelerate growth in both earnings and revenue. Microsoft, through its partnership with OpenAI Inc., is seen as one of the biggest beneficiaries of AI. It has released AI-supported services to customers. 

“We understand that companies like Apple and Google and Meta are working on ways to monetize generative AI, but you have to admit that Microsoft right now really is the only working model where you can engage with chatGPT for a subscription,” said Brian Mulberry, client portfolio manager at Zacks Investment Management.

Demand for AI services, along with cloud computing to support it, is projected to support Microsoft’s long-term growth trends. Revenue is expected to rise 15% in its 2024 fiscal year, faster than the overall tech sector, according to data from Bloomberg Intelligence.

Microsoft will report its second-quarter results later this month.

This kind of growth has resulted in Microsoft being one of the most popular stocks on Wall Street. More than 90% of the analysts tracked by Bloomberg recommend buying shares, and the average analyst price target points to upside of about 7% from current levels.

--With assistance from Carmen Reinicke.

(Updates to market close.)

©2024 Bloomberg L.P.