Palantir Was the Top-Performing Stock in the S&P 500 in 2024. But This Other Artificial Intelligence (AI) Powerhouse Has Been the Best S&P 500 Stock Over the Last 2 Decades.

Source The Motley Fool

Following a terrific performance in 2023, the S&P 500 and Nasdaq Composite posted another year of generous gains in 2024. Among the market's biggest gainers over the last two years have been megacap technology stocks -- collectively referred to as the "Magnificent Seven."

However, last year a smaller player actually outperformed each and every one of its peers by a considerable margin. In 2024, shares of data analytics firm Palantir Technologies (NASDAQ: PLTR) soared by 340% -- making it the top performer in the S&P 500 index.

Start Your Mornings Smarter! Wake up with Breakfast news in your inbox every market day. Sign Up For Free »

With that said, Palantir's soaring share price has resulted in some considerable expansion of its valuation. By most traditional valuation metrics, Palantir stock should be considered pricey and overbought at the moment.

Upward and downward facing arrows behind blocks that spell out S&P 500.

Image source: Getty Images.

Below, I'll reveal which artificial intelligence (AI) stock has been a superior performer in the S&P 500 over the long run. Additionally, I'll explain why this stock should be considered reasonably valued and could make for a tempting buy right now.

The top performer in the S&P 500 over the long-run

According to data compiled by YCharts, semiconductor stock Nvidia (NASDAQ: NVDA) has been the top performer in the S&P 500 over the long run. In the table below, I've broken down Nvidia's total return over the last five, 10, 15, and 20 years.

Metric 5 Years 10 Years 15 Years 20 Years
Nvidia total stock return 2,130% 28,650% 32,990% 82,830%

Data source: YCharts.

To put these percentages into perspective, if you had invested even just $1,000 into Nvidia 20 years ago then you would have over $800,000 today.

There are a few ideas I'd like to explore given the figures above. Every now and again a game-changing company comes along and turns a modest investment into generational wealth. However, returns of this magnitude are quite uncommon.

The broader theme I'd like to drive home is the importance of long-term investing. Berkshire Hathaway CEO and world-renowned investor Warren Buffett once said, "If you aren't thinking about owning a stock for ten years, don't even think about owning it for ten minutes." Clearly, holding onto Nvidia stock over the last two decades has been a wise decision.

Nevertheless, just because you decide to buy a stock and hold it for many years does not guarantee market-beating returns. Whether people want to admit it or not, there is always some degree of luck involved in the world of investing.

NVDA Total Return Level Chart

NVDA Total Return Level data by YCharts

In the chart above, you can see that the majority of Nvidia's gains took place over the last couple of years. The reason? Because AI became the next megatrend in the stock market, and Nvidia's critical role in the space has fueled an epic period of prolonged buying activity.

Ultimately, while those who bought Nvidia stock 20 years ago and actually held it have a lot to be happy about, it's highly unlikely those people were thinking about AI when they took a position in the company.

Reasonably valued despite a soaring stock price

In 2024 alone, shares of Nvidia rose by 171% and the company gained over $2 trillion in market capitalization. Yet despite this unprecedented pace of valuation growth, Nvidia stock remains reasonably valued.

NVDA Net Income (Quarterly) Chart

NVDA Net Income (Quarterly) data by YCharts

The chart above illustrates an interesting dynamic between Nvidia's revenue and profitability. Specifically, while AI tailwinds have fueled record growth for the company across the board, Nvidia's net income and free cash flow are accelerating at a faster pace than the company's market value.

This means that even though Nvidia stock has climbed exponentially over the past few years, shares remain at a reasonable price point when looked at through the lens of profit-based valuation metrics such as price-to-earnings (P/E) or price-to-free-cash-flow (P/FCF) ratios.

Right now, Nvidia stock trades at a forward price-to-earnings ratio of 31.7 -- nearly identical to where it was trading this time last year. Considering 2025 is looking like it will be yet another milestone year for the company thanks to its new Blackwell chip architecture, I suspect Nvidia's profit margins are in a good position to continue expanding.

So long as the current dynamic illustrated in the chart above continues to hold, Nvidia stock should remain fairly priced -- making it a screaming buy for investors with a long-term time horizon.

Should you invest $1,000 in Nvidia right now?

Before you buy stock in Nvidia, consider this:

The Motley Fool Stock Advisor analyst team just identified what they believe are the 10 best stocks for investors to buy now… and Nvidia wasn’t one of them. The 10 stocks that made the cut could produce monster returns in the coming years.

Consider when Nvidia made this list on April 15, 2005... if you invested $1,000 at the time of our recommendation, you’d have $807,495!*

Stock Advisor provides investors with an easy-to-follow blueprint for success, including guidance on building a portfolio, regular updates from analysts, and two new stock picks each month. The Stock Advisor service has more than quadrupled the return of S&P 500 since 2002*.

See the 10 stocks »

*Stock Advisor returns as of January 13, 2025

Adam Spatacco has positions in Nvidia and Palantir Technologies. The Motley Fool has positions in and recommends Berkshire Hathaway, Nvidia, and Palantir Technologies. The Motley Fool has a disclosure policy.

Disclaimer: For information purposes only. Past performance is not indicative of future results.
placeholder
Gold sinks as risk appetite improves on Trump-Powell calm, China tariff relief hopesGold prices plunged more than 2.50% on Wednesday as risk appetite improved due to a possible de-escalation of US-China tensions and US President Donald Trump's statement that he doesn’t plan to fire Federal Reserve (Fed) Chair Jerome Powell.
Author  FXStreet
Yesterday 01: 32
Gold prices plunged more than 2.50% on Wednesday as risk appetite improved due to a possible de-escalation of US-China tensions and US President Donald Trump's statement that he doesn’t plan to fire Federal Reserve (Fed) Chair Jerome Powell.
placeholder
Bitcoin Price Stabilizes After Surge — Is It Gearing Up for Another Leg Up?Bitcoin price is moving higher above the $93,200 zone. BTC is consolidating gains and might continue higher above the $94,000 zone in the near term.
Author  NewsBTC
Yesterday 03: 22
Bitcoin price is moving higher above the $93,200 zone. BTC is consolidating gains and might continue higher above the $94,000 zone in the near term.
placeholder
Gold price bulls could regain control amid fading US-China trade deal optimismGold price (XAU/USD) attracts fresh buyers during the Asian session on Thursday, reversing the previous day's heavy losses and snapping a two-day losing streak to the $3,260 area or the weekly low.
Author  FXStreet
22 hours ago
Gold price (XAU/USD) attracts fresh buyers during the Asian session on Thursday, reversing the previous day's heavy losses and snapping a two-day losing streak to the $3,260 area or the weekly low.
placeholder
Forex Today: Easing geopolitical tensions support USD ahead of mid-tier dataThe US Dollar (USD) stays resilient against its peers early Thursday after posting gains for two consecutive days.
Author  FXStreet
20 hours ago
The US Dollar (USD) stays resilient against its peers early Thursday after posting gains for two consecutive days.
placeholder
Gold price snaps selling off after fresh Trump comments on tariffsGold price (XAU/USD) is turning positive, recovering above the $$3,300 level at the time of writing on Thursday after two days of firm selling pressure since it topped at $3,500 on Tuesday.
Author  FXStreet
19 hours ago
Gold price (XAU/USD) is turning positive, recovering above the $$3,300 level at the time of writing on Thursday after two days of firm selling pressure since it topped at $3,500 on Tuesday.
goTop
quote