Nvidia (NVDA -0.83%) and Microsoft (MSFT 0.23%) are pioneers in artificial intelligence (AI) as both companies have played central roles in bringing this technology mainstream.

While Microsoft-backed OpenAI kicked off the AI craze when it launched the highly popular ChatGPT in November 2022, the chatbot may not have seen the light of the day without Nvidia's graphics processing units (GPUs), which were used for training the large language model (LLM) powering ChatGPT. As other major tech giants joined the AI race, the demand for Nvidia's chips went through the roof, and sent its revenue and bottom line soaring.

Meanwhile, the impact of AI on Microsoft's business has been gradual. The company is spending billions to build its AI data center infrastructure -- benefiting Nvidia in the process -- and believes its AI-focused investments will "support monetization over the next 15 years and beyond." This explains why Nvidia stock has outperformed Microsoft's by a massive margin in the past couple of years.

NVDA Chart

NVDA data by YCharts.

But will Nvidia continue to outperform Microsoft in 2025? Let's find out.

Microsoft's AI-driven growth should gain momentum, while Nvidia faces challenges

As already mentioned, Microsoft is benefiting gradually from AI. The company's revenue in fiscal year 2024 (that ended June 30) was up 16% from the previous year to $245 billion. Its adjusted earnings increased 20% year over year to $11.80 per share. The company's estimated revenue growth rate of 14% for fiscal 2025 to $278.6 billion isn't all that great, while its earnings are expected to increase by 10.5% to $13.04 per share.

The forecasts for fiscal 2026, which will begin in July 2025, don't point toward a major improvement either. Consensus estimates are projecting a 14% increase in Microsoft's revenue in the next fiscal year, along with a 15% jump in earnings.

MSFT Revenue Estimates for Next Fiscal Year Chart

MSFT Revenue Estimates for Next Fiscal Year data by YCharts.

Nvidia, on the other hand, is expected to finish the current fiscal year (ending January 2025) with outstanding revenue growth of 112% to $129 billion, followed by a 52% increase in the next fiscal year to $196 billion. Nvidia's bottom line is also expected to jump an impressive 128% in the ongoing fiscal year followed by a 50% jump in the next one.

All this indicates that Nvidia could continue to grow at a much faster pace than Microsoft over the course of the next year. What's more, the 12-month median price targets of both companies suggest that Nvidia stock could rise 33% while Microsoft is expected to deliver 20% gains. So, the odds seem in favor of Nvidia outperforming Microsoft in 2025, and that's not surprising considering that the chipmaker continues to witness outstanding demand for its AI data center GPUs.

However, investors would do well to note that a few concerns could weigh on Nvidia stock. From potential restrictions that could be imposed on sales of its AI chips to foreign countries to an expensive valuation to the efforts being undertaken by major Nvidia customers to reduce their reliance on its chips, there are multiple reasons why Nvidia shares may remain under pressure.

Moreover, the company's growth rate -- though still impressive -- is gradually slowing down. These are the reasons why Nvidia stock may lose its shine in 2025. Microsoft, on the other hand, is slowly but steadily stepping up its game in key AI-focused niches that could set it up for outstanding growth in the long run.

The tech giant is already gaining share in the cloud computing market thanks to AI. Microsoft's Azure cloud and other services revenue increased by 33% in the first quarter of fiscal 2025, with AI contributing 12 percentage points of that growth. More importantly, AI is helping Microsoft build a solid revenue pipeline by driving an increase in the number of big contracts that the company is signing for its Azure cloud solutions.

This is evident from the 22% increase in Microsoft's commercial remaining performance obligations (RPO) in fiscal Q1 2025 to $259 billion. The faster growth in RPO as compared to the revenue bodes well for Microsoft, as this metric refers to the total value of a company's unfulfilled contracts. Microsoft expects to recognize 40% of its RPO as revenue in the next 12 months, which would be an increase of 17% on a year-over-year basis.

As a result, the possibility of Microsoft growing at a faster pace than Wall Street's expectations in the coming year cannot be ruled out. A similar story could unfold at Nvidia, and the company could overcome the adversity that it is facing right now.

Though the outgoing administration's potential curbs on Nvidia chip exports could post a threat to its remarkable revenue growth -- 56% of its revenue is from customers outside the U.S. -- investors should note the rules will be enforced 120 days from now, giving the incoming administration time to weigh in on the new rules.

Looking at the positive side of things, Nvidia's focus on significantly enhancing the production capacity of its latest Blackwell AI processors to meet the red-hot demand from its customers, along with the massive increase in AI infrastructure spend by its U.S. customers, could be enough to help the company grow at an impressive pace once again in 2025. As such, the possibility of Nvidia stock retaining its mojo despite the potential challenges it faces cannot be ruled out.

What should investors do?

The uncertainties surrounding Nvidia may tempt investors to put their money into Microsoft stock to capitalize on the AI boom, especially considering the latter's valuation. After all, Microsoft is trading at a much cheaper 34 times earnings as compared to Nvidia's earnings multiple of 52.

However, Nvidia's forward earnings multiple of 31 is in line with Microsoft's, and that's not surprising considering the outstanding growth that the company is expected to deliver. This makes Nvidia an attractive AI stock to buy right now, and investors can consider using the negative press surrounding it as a buying opportunity considering that its huge addressable market could be enough to help it overcome any potential regulatory challenges.

But at the same time, even Microsoft looks like a top AI stock to buy for the long run considering the massive opportunities in cloud computing and workplace collaboration that could supercharge its growth.

So, investors can consider buying any one of these two AI stocks right now depending on their risk appetite, and there is a good chance that they may not go wrong in 2025, as well as in the long run, as both Microsoft and Nvidia are sitting on lucrative end markets thanks to AI.