Nvidia (NVDA 6.18%) has delivered market-smashing returns for investors. The graphics chip leader's share price has rocketed 1,900% over the last five years, outpacing the broader market and Apple's (AAPL -0.35%) 317% return.

Nvidia's superior returns reflect the tremendous growth it has experienced from data center customers for its high-powered graphics processors. However, Apple is the more valuable company right now, with a market capitalization of $2.8 trillion, and that is likely to increase as it wins more customers with the iPhone. This means Nvidia, which has a market of just under $2 trillion, will likely have to keep growing at high rates to surpass Apple's market value.

Let's see what Apple could be worth in six years and whether Nvidia can beat it.

Apple stock could rise as much as 80% using Wall Street's growth expectations

Apple has a diverse revenue stream coming from a roster of several products and services, but the iPhone is still the cash machine, making up 42% of the company's revenue in fiscal 2023. Dependency on the iPhone has made Apple's revenue growth inconsistent in recent years, but overall, Apple is benefiting from its growing installed base of devices, which is now over 2.2 billion and could keep growing for several more years.

The global smartphone market is expected to increase by a total of 1.5 billion users by 2029, according to Statista. If Apple captures 20% of that increase, consistent with its recent share of the global smartphone market, that would add another 300 million customers for the iPhone. That could significantly increase the company's installed base of devices as some of those customers go on to buy other products.

The Wall Street consensus has Apple's annual revenue reaching $512 billion by fiscal 2027, which would be annualized growth of 7.5% from last year's total.

Analysts project Apple's earnings per share to grow at a compound rate of 9.4% over the long term. It reported earnings per share of $6.13 last year, so that would put the company's earnings in 2030 at $11.64.

If Apple stock is still trading at a forward price-to-earnings (P/E) ratio of 28, the stock price would trade at $325 in 2030, or 80% above its current share price. Assuming Apple's shares outstanding remain constant, its market cap (stock price times shares outstanding) would also increase by 80% and reach $5 trillion in six years.

Nvidia's growth hinges on AI spending

Nvidia's market cap is currently $1.95 trillion, so its share price would have to more than double to match Apple's projected market cap of $5 trillion in six years.

The good news is that Nvidia is experiencing surging demand for its chip hardware as data centers start upgrading their systems to train a computer to learn by itself. Spending on artificial intelligence (AI) technology is projected to grow from $200 billion to $1.8 trillion by 2030, according to Statista.

Nvidia makes graphics processing units (GPUs) used for playing video games and powering incredibly complicated computing models for AI training, robotics, and self-driving cars. However, data center revenue made up 78% of the business last year and grew 217%.

As that triple-digit level of growth suggests, it's got a long growth runway. Most of Nvidia's data center growth has recently come from large cloud providers, but other industries are starting to invest in AI infrastructure, including healthcare and financial services.

Analysts expect Nvidia's total revenue to triple by 2027 to $192 billion. Earnings are projected to grow 35% per year, which would put its future earnings at $105 by 2030.

Nvidia trades at a high P/E based on its trailing earnings, but looking ahead to this year's estimate, it trades at a more reasonable forward P/E of 32. Assuming Nvidia is still trading at the same forward P/E, its stock price could reach $3,360 by the end of 2030, or 328% above the current share price. That would put its market cap at over $8 trillion.

Nvidia stock is the better buy

The GPU is essential to power the stringent demands on data processing that AI requires, and this market is dominated by a duopoly between Nvidia and Advanced Micro Devices. What makes Nvidia a safe bet is that it has led the GPU market for many years and currently controls an estimated 80% share of AI chips. Nvidia is more dominant in GPUs than Apple is in smartphones.

Nvidia appears to be on track to not only exceed Apple's market cap but potentially become the most valuable company in the world in the next decade.