The ongoing excitement around artificial intelligence (AI) has helped drive the stock market higher in recent years. Industry analysts, executives, and even investors are starting to believe that this technology could provide a major lift to the economy in the long run. So, it's best to have exposure to this trend in your portfolio.

There hasn't been a better way to play the rise of AI than owning Nvidia (NVDA -0.12%). The stock has rocketed 1,530% higher just in the past five years (as of July 23) as it continues to register unbelievable growth. The business now carries a market cap of $4.1 trillion, making it the most valuable company on Earth.

But where will Nvidia be in five years? Investors should think about the situation holistically.

Nvidia headquarters with Nvidia sign in front.

Image source: Nvidia.

Demand continues to be strong

No company wants to get left behind in the AI race. This is particularly true when it comes to training AI models and building related apps. All of this requires substantial computational power. This need for power has supported sales growth for Nvidia.

The company sells powerful graphics processing units (GPUs) that help run data centers. This segment alone raked in $39.1 billion in revenue in the first quarter of 2026 (ended April 27), a 73% year-over-year jump representing 89% of Nvidia's total revenue.

While it's not realistic to expect Nvidia to grow to the sky, Wall Street remains optimistic. The consensus analyst forecast calls for the company's revenue to increase at a compound annual rate of 31.5% between fiscal 2025 and fiscal 2028. According to a UN Trade and Development report, the global market for AI will be valued at $4.8 trillion in 2033 compared to just $189 billion in 2023, which leaves plenty of upside for Nvidia in the years ahead.

That demand is driving incredible profitability. In the past five years, Nvidia's operating margin has averaged a fantastic 40%. Competition could bring this down over time, as it can result in pricing pressure with supply catching up to the insatiable demand. But Nvidia's leading position in the industry, coupled with the success of its CUDA software platform, make it the envy of its peers.

What if AI is a bust?

There has certainly been a lot of hype surrounding AI. Some believe the technology will completely alter our economy, disrupt industries, and force many people out of work as AI begins to automate and replace jobs. And GDP will supposedly get a boost along the way.

That could happen. However, a more reasonable outlook makes the most sense. Bill Gates, co-founder and former CEO of Microsoft, once said something along the lines of humans overestimating what a new technology could do in the short term and underestimating what it does in the long term.

I think this is the right way to view the possible trajectory of AI. The massive amounts of spending on AI development can't continue indefinitely. And no one has any clue about what related innovations will be built far into the future. Settling somewhere in the middle is ideal.

But what if AI is a total bust? If it doesn't usher in a new wave of product and service launches that create legitimate revenue-generating opportunities, then it might be all hype with no results.

Nvidia has been the single biggest beneficiary of the AI infrastructure boom. But if the ultimate financial returns don't support all its customers' capital expenditures, then the durability of demand and growth is a huge question mark over the next five years and beyond.

Nvidia stock could beat the market

As of this writing on July 23, shares of Nvidia trade at a forward price-to-earnings ratio of 39.5. Given its monster revenue and profit growth, as well as its dominant industry position, I don't view the valuation as being expensive.

Therefore, I wouldn't be surprised if this AI stock beats the market between now and 2030. In my opinion, it all depends on whether or not AI really is the game-changing technology that many believe it to be.