March 8 was a wild day in the stock market. Shares of Nvidia (NVDA 6.18%) surged to an all-time high of $974 only to fall over 10% from that high to end the day at $875.28. At the peak, Nvidia was less than 9% away from surpassing Apple (AAPL -0.35%) in market cap. By close, it was a little over 20% away.

Given Nvidia's big swings, it seems like the stock could very well surpass Apple to become the second most valuable "Magnificent Seven" stock behind Microsoft. Here's why Nvidia could keep outperforming Apple in the short term, but why Apple is the better long-term buy.

A person working on a laptop overlooking a data center.

Image source: Getty Images.

Earnings are driving the Nvidia story

Nvidia is not an unprofitable growth stock that is rallying based on optimism and greed alone (although those are contributing factors). The business is doing phenomenally well, achieving a level of sales and earnings growth paired with margin expansion.

NVDA Revenue (TTM) Chart

NVDA Revenue (TTM) data by YCharts

The only concern with Nvidia is its valuation. Its price-to-earnings (P/E) ratio based on its trailing 12-month (TTM) earnings is 73.6. But consensus analyst estimates expect Nvidia's earnings per share (EPS) to more than double from the $11.90 it earned in fiscal 2024 to $24.50 in fiscal 2025. That gives Nvidia a forward P/E of 35.7 -- which is far more reasonable.

The easiest way for Nvidia to pass Apple in market cap is for investors to keep bidding up the stock. But the more realistic way is if Nvidia's earnings live up to expectations.

Nvidia will report its full-year fiscal 2025 results some time in late February or early March next year. If it reports $24.50 in earnings, the stock would likely be far higher, especially if there is optimism for even more growth ahead. A business that is more than doubling earnings with high margins and leading the artificial intelligence (AI) revolution deserves a premium valuation, probably something like double the P/E of the S&P 500.

Nvidia deserves the highest P/E of all the Magnificent Seven companies, but the company is nearing a point where it is running up too far, too fast.

Nvidia benefited from earnings growth and a valuation expansion. It's hard to assume the valuation will continue to expand, but the stock could still go up if the first half of fiscal 2025 goes as analysts expect. Each new quarter of high earnings will increase the trailing-12-month number and lower the P/E, leaving room for the stock to rise to fill the gap. There is nothing better in the stock market than earnings growth, and right now Nvidia has it, and Apple doesn't.

Buying Apple when it is out of favor has historically been a genius move

So why is Apple the better buy if Nvidia has such an easy path forward? Simply put, I think the setup for Apple makes it a much better investment. Nvidia may be the better trade, but a more surefire way of building wealth is by compounding over the long term.

Market sentiment is negative toward Apple. So negative, in fact, that Apple trades at a discount to the S&P 500. The only reason that should ever happen is if something serious was going wrong with Apple. The company has its challenges, but none of them warrant an underperformance like we have been seeing for the last six months or so.

The abridged version of why Apple stock is under pressure is because it hasn't captured the spotlight with some major AI monetization announcement (Nvidia, Microsoft, and Meta Platforms have). iPhone sales are down in China, and growth is sluggish in general. But Apple has endured these periods before and overcome competition.

Piper Sandler's fall 2023 survey found that 87% of Gen Z had an iPhone, 88% expected their next phone to be an iPhone, and 34% owned an Apple Watch. The iPhone is essentially a consumer staple in the U.S. and is growing well across international markets outside of China.

Investors should focus less on the competition and more on Apple's ability to further monetize its existing devices through services and AI. The key for Apple has always been to increase the depth (services) and breadth (more products like phones, computers, tablets, wearables, ear buds, and more) of its ecosystem. Having lifetime customers consistently increase their spending relies on product improvements.

The pressure is on Apple to make a splash this summer to drive iPhone demand and upgrades. If Apple delivers the improvements that drive growth, the stock could soar. But even if it doesn't, it generates plenty of extra cash to make an acquisition and grow that way, or return cash to shareholders while maintaining a rock-solid balance sheet.

Apple's brand, market position, and financial health give it the time and the wiggle room needed to make mistakes. The company is known for not leading investors on and only makes announcements when it feels the product or service is ready.

Apple has a better risk/reward profile than Nvidia

Nvidia has to hit sky-high earnings forecasts to keep going up. The semiconductor industry is also highly cyclical, and a downturn in customer spending could stall its growth trajectory. Nvidia may keep growing at a breakneck pace in the near term, but eventually, it will slow down. When that time comes, investors may be less willing to give Nvidia a multiple that is triple the market average.

Meanwhile, Apple is already a good value and has a clear path toward regaining Wall Street's favor.

I don't have a crystal ball, but if I had to guess, I would say Nvidia will briefly become more valuable than Apple. But three to five years from now, I think Apple will be worth more than Nvidia while also being a safer and less volatile investment.

Nvidia stands out as a high-risk/high-potential-reward play, while Apple is more like a low-risk/medium-potential-reward investment. Investors who are confident about sustained high demand for Nvidia's products will want to watch each quarterly earnings report, understanding the importance earnings play in the story. The big gains have already been made in Nvidia, and investors should expect more reasonable returns going forward.