Nvidia (NVDA -0.79%) has been one of the hottest stocks on the market in recent months, and that's not surprising, as the company has played a critical role in the artificial intelligence (AI) revolution.

Companies in the race to develop and deploy AI applications have been turning to Nvidia's graphics processing units (GPUs) to utilize the parallel computational power of its chips so that they can train large language models (LLMs) such as ChatGPT. As it turns out, the demand for Nvidia's GPUs has been so strong that the company has been finding it difficult to meet the end-market demand, leading to long waiting periods.

The good news is that Nvidia has been boosting its production capacity, and that explains why it is expected to deliver another year of solid growth in fiscal 2025 (which has just begun). Its top line is expected to grow nearly 84% this fiscal year to $112 billion, while the bottom line is expected to jump 91% to $24.87 per share. All this explains why investors have been piling into Nvidia stock, which has already gained more than 82% in 2024.

Nvidia looks well placed to justify its expensive trailing earnings multiple of 75, considering the potential growth it could deliver. The sharp increase in its earnings going forward is evident from a much lower forward price-to-earnings ratio of 37. However, investors who have missed Nvidia's terrific run-up and are wary of paying a rich earnings multiple can consider taking a closer look at Microsoft (MSFT 0.11%).

Just like Nvidia, Microsoft is also a key player in the AI market, and it can be bought at a reasonable valuation right now. Here's why savvy investors should consider doing that right away.

Microsoft stock is attractively valued, and AI is positively impacting its growth

Shares of Microsoft have gained only 10% so far this year. This explains why the stock can still be bought at a relatively reasonable earnings multiple of about 35, which is much lower than Nvidia's multiple. Microsoft's forward earnings multiple of 31 also represents a discount to that of Nvidia.

Of course, Microsoft isn't growing as rapidly as Nvidia, but it has been consistently beating Wall Street's earnings expectations in recent quarters, and its growth has been accelerating.

For instance, in the third quarter of fiscal 2024 (which ended on March 31), Microsoft's revenue increased 17% year over year to $61.9 billion. That was a nice acceleration over the 7% revenue growth the company clocked in the same period last year.

Additionally, Microsoft's earnings growth also improved to 20% year over year in the previous quarter, from 10% in the year-ago period. AI is playing a key role in this acceleration, as Microsoft management noted on the latest earnings conference call. CEO Satya Nadella remarked that the company's Azure cloud platform "took share as customers use our platforms and tools to build their own AI solutions."

More specifically, AI drove 7 percentage points worth of growth for Microsoft's Azure cloud business last quarter out of the segment's year-over-year growth of 31%. The growth could have been stronger had Microsoft been able to meet all the AI-related demand for cloud services, but the company said that demand has been higher than supply.

This explains why Microsoft has been ramping up its spending on cloud AI infrastructure across the globe in countries such as Japan, France, Indonesia, Malaysia, and the U.S. Even better, recent reports indicate that the tech giant could spend $100 billion on building a generative AI supercomputer through 2028. As such, Microsoft is setting itself up to make the most of the booming demand for cloud AI services in the long run.

According to a third-party estimate, the cloud AI market was worth an estimated $43 billion in 2022. The market is expected to post 36% annual growth through 2032 and generate a whopping $887 billion in annual revenue. Microsoft has generated just over $100 billion in revenue from its Intelligent Cloud division business in the past year, and the incremental growth opportunity in the cloud AI market indicates that it has a lot of room to grow in this space.

Throw in the potential AI-related gains that Microsoft could achieve in the AI-enabled personal computer and workplace productivity markets, and it won't be surprising to see the company's growth accelerating further in the long run.

Robust earnings growth points toward a healthy stock price upside

Analysts are expecting Microsoft's earnings to increase at an annual rate of 16% over the next five years, which would be a slowdown compared to its 20% annual earnings growth in the past five years. However, observers have already seen that Microsoft's bottom-line growth is accelerating thanks to AI. So, it won't be surprising to see the company's earnings growing at a faster pace in the future.

Assuming Microsoft manages to get an annual earnings growth rate of 25% over the next five years, its earnings could hit $29.93 per share in fiscal 2028 (using fiscal 2023 earnings of $9.81 per share as the base). Multiplying the projected earnings with Microsoft's five-year forward earnings of 29 points toward a stock price of $868 after five years -- a jump of 110% from current levels.

But if the market decides to reward Microsoft with a higher valuation or the company delivers stronger earnings growth, this AI stock could deliver much stronger gains. That's why investors who missed the Nvidia train should consider jumping onto Microsoft stock before it steps on the gas.