A lot has changed for Nvidia (NVDA 2.53%) in the last five years -- and for its investors. Shares have skyrocketed by more than 1,400% since then, handily outpacing the S&P 500 (SNPINDEX: ^GSPC), which has only grown by 93% over that same period.

So, what do the next five years hold in store for Nvidia? Should investors expect another big rally for the stock, or are shares destined to fall back to Earth?

Here's what I think.

Stock chart with an upward arrow.

Image source: Getty Images.

Nvidia's amazing five-year rally

First, let's recap what's happened over the last five years for Nvidia. In 2020, Nvidia was already a large company, with a market cap of $225 billion and annual revenue of $13 billion. However, today, the company boasts a market cap of more than $3.4 trillion, and its annual revenue is almost $150 billion.

Behind this incredible rally is the growth of the artificial intelligence (AI) chip market. Nvidia designs the graphics processing units (GPUs) that provide the computing power required to train and run large language models (LLMs).

Nvidia's GPUs, like the H100, H200, and Blackwell, have formed the backbone of an AI chip empire that has pushed the company all the way to the top of the list of largest American companies (by market cap).

Can Nvidia remain the king of AI over the next five years?

One of the most challenging parts of analyzing Nvidia's 2030 prospects is that its chief market -- the GPU data center industry -- is a cutting-edge field, and it's unclear how much it will grow over the next five years.

Because of that, analyst estimates for Nvidia's 2030 revenue vary wildly. Estimates range from the low end of $281 billion to $600 billion at the top end.

Beyond the question of how much Nvidia can generate in revenue is how much of those sales the company can convert to profits.

At the moment, Nvidia has far and away the best margins in its industry. Indeed, its margins stand head and shoulders above some of its longtime competitors like AMD and Intel.

NVDA Gross Profit Margin Chart

NVDA Gross Profit Margin data by YCharts

However, those companies are ramping up their efforts to compete with Nvidia in the lucrative AI GPU market. AMD has its own series of AI GPUs on the market that offer AI developers an alternative to Nvidia. Similarly, Intel is making efforts to grow its share of the AI GPU market. Finally, most of the big tech companies, like Apple, Alphabet, Amazon, Microsoft, and Meta Platforms, have also started work on developing their own AI chips.

In other words, the market could be a much more competitive space by 2030, even if Nvidia retains its spot at the top, meaning its margins could shrink and its future earnings could grow less than investors might hope for.

Is Nvidia a buy now?

Nvidia remains one of the top beneficiaries of the AI revolution. And while it's true that increased competition could eat away at the company's margins, it's also true that the rapid growth of the overall AI chip market might outweigh the threat of increased competition.

That leads me to believe that Nvidia remains a solid long-term investment. While investors shouldn't count on the stock to duplicate its amazing performance over the last five years, I expect Nvidia to match and modestly outperform the S&P 500 by 2030.