On Tuesday, June 18, Nvidia (NVDA 0.25%) passed Microsoft (MSFT 0.27%) to become the world's most valuable publicly traded company for the very first time. As of this writing, Nvidia stock is up more than 200% in the past year and is now worth over $3.3 trillion.

Now that its stock is the world's most valuable (based on market cap), many investors likely are wondering if they should sell or continue holding. Some who are on the sidelines might even wonder if it's too late to buy. Perhaps history can be a guide to making these decisions.

When it comes to the most valuable stock listed on a U.S. exchange, there have been four other companies that have worn the crown over the last 30 years: General Electric, which is now GE Aerospace (GE 0.57%), Microsoft, ExxonMobil (XOM 0.04%), and Apple (AAPL 2.00%). And investors might be pleasantly surprised by what happened to these stocks after reaching the top.

Nvidia could stay at the top for a while

On Sept. 15, 1998, Microsoft passed General Electric to become the most valuable stock for the first time. According to data from the nonprofit American Business History Center, General Electric had been the top company without interruption for several years.

For its part, Microsoft sat by itself at the top of the leaderboard for a couple of years. Moreover, the stock more than doubled less than two years after it initially passed General Electric.

This is the first lesson from history: Once a company reaches the top, it tends to stay at the top for multiple years. That was the case for General Electric and Microsoft.

And it was also the case for ExxonMobil and Apple. Therefore, if it follows the historical pattern, Nvidia stock will also likely enjoy a prolonged period at the top.

Once a company initially becomes the most valuable, history shows the stock price usually hasn't peaked yet. For example, ExxonMobil topped General Electric in February 2005. From there, the oil company's stock would rise another 60% over the next couple of years and 75% over the following decade.

XOM Chart

XOM data by YCharts.

Apple passed ExxonMobil in August 2011. In the five years leading up to taking the top spot, the stock was up around 500%, which is spectacular. Many investors likely thought they had missed the boat. But the stock didn't stop there: It doubled again over the subsequent five years.

Therefore, if history is any guide, Nvidia stock could enjoy multiple years at the top and continue increasing in value.

History has one more thing to show investors

Perhaps the most surprising thing from history is that the previous most valuable stocks outperformed the S&P 500 for the next five years after they reached the top.

Company Five-Year Performance After
Becoming the Most Valuable Stock
Comparable Performance
of the S&P 500
Percentage Points
of Alpha
Microsoft 5% (2%) 7
ExxonMobil 11% (8%) 19
Apple 102% 86% 16
Nvidia ? ? ?

Return data according to YCharts. Chart by author. *Alpha refers to a stock's performance relative to a benchmark (in this case, the S&P 500) and is designated in terms of percentage-point difference.

It's important to zoom out and consider why this is true. It's because a company doesn't just become the world's most valuable for no reason. Something good must be happening with the business. And whatever trends are in the company's favor tend to last for multiple years, at least.

For Microsoft, it rode the PC revolution to take the top spot. ExxonMobil benefited from an extreme and prolonged spike in oil prices. And Apple was at the front of the smartphone trend. These were material drivers of each business that played out over years, not days.

Nvidia is benefiting from the surging adoption of artificial intelligence (AI). Even if there's a lot of over-the-top hype with this trend, important things are happening in AI, and many businesses are likely to continue experimenting with the technology's application in the coming years. This means that business could stay good for Nvidia, leading to more market-beating gains.

As an investor who places a strong emphasis on value, the valuation of Nvidia stock personally makes me quite nervous. The market cap is over $3 trillion, and it trades at an extreme price-to-sales (P/S) ratio of 42. In the history of the stock market, there has never been a company this big that sported a valuation this high. For perspective, Nvidia's valuation is currently triple the valuation of Microsoft in the second-place spot.

My discomfort with the valuation aside, I can't deny that history says Nvidia stock hasn't peaked yet. It could stay at the top for multiple years. And it could outperform the S&P 500 from here as the AI trend continues to play out.