In the 1990s, seemingly any company with a link to the internet saw its share price soar. A similar (although less exuberant) phenomenon appears to be underway now. The difference this time is that the technology in question is artificial intelligence (AI).

Several tech giants are especially on a roll. Shares of Amazon (AMZN 0.81%) have jumped nearly 20% so far in 2023. Nvidia (NVDA 3.75%) stands out as one of the biggest winners of all, with a year-to-date gain of over 85%. 

But which of these will be the better AI stock over the long run? Here's how Amazon and Nvidia stack up against each other.

The case for Amazon

Amazon's most visible AI product is its Alexa virtual assistant. As widely used as Alexa is, though, it's not the most significant AI opportunity for Amazon. That distinction belongs to the company's Amazon Web Services (AWS) unit.

AWS ranks as the largest cloud services provider in the world, with a market share of 33%, according to technology services company AAG. It's a key growth driver and Amazon's most profitable business.

Organizations that want to build AI applications in the cloud already have plenty of tools at their disposal with AWS. AI services offered include building chatbots, speech recognition, text-to-speech, image and video analysis, language translation, and a lot more. 

Amazon is poised for tremendous growth over the next decade and beyond, thanks in large part to AWS' AI opportunity. But AI isn't the only business that could provide a major catalyst for the stock. Other major potential growth drivers for Amazon include connected TV and healthcare.

The case for Nvidia

Nvidia rose to success because its graphics processing units (GPUs) were the gold standard for powering gaming apps. Gaming remains a huge moneymaker for the company -- and a significant growth opportunity as well. 

However, Nvidia's future fortunes are linked to AI more than anything else. The same attributes that made the company's GPUs so great for gaming also make them ideal for AI apps.

Many of the biggest names in AI have teamed up with Nvidia. Amazon's AWS and Nvidia have been partners for over 10 years and announced a new generative AI collaboration last month. Alphabet is integrating Nvidia's GPUs with its Google Cloud Vertex AI platform. Microsoft is making Nvidia's DGX Cloud AI supercomputer available to customers on its Azure cloud platform. 

Nvidia doesn't just have powerful chips and hardware, though. It offers a full-blown AI platform including its supercomputer, software, AI models, and services. The company's AI solutions feature data analytics, generative AI, speech AI, self-driving car technology, and more.

One of the most intriguing AI innovations from Nvidia is its new cuLitho software library. This AI software helps chipmakers significantly speed up their manufacturing process. In a real sense, AI could help make AI better with cuLitho.

Better AI stock?

Both Amazon and Nvidia should have tremendous growth potential amid the AI boom. However, we haven't discussed two important factors yet: competition and valuation.

Amazon's AWS unit faces increasingly tough competition from other cloud services providers, notably including Google Cloud and Microsoft Azure. It's possible (and arguably probable) that these two main rivals will gain market share at AWS' expense.

Likewise, Nvidia has competition in the AI arena. In particular, AMD is betting big on AI. For now, though, Nvidia appears to have a clear advantage.  

Both Amazon and Nvidia stocks trade at lofty earnings multiples. However, Amazon is taking steps to increase its profits, which should lead to stronger earnings growth over the next few years. Meanwhile, some investors are worried that Nvidia's share price has risen too much, too quickly.

I like and own both of these stocks. Amazon is one of my favorite stocks to buy right now. My view, though, is that Nvidia is in a better position than Amazon to profit in more ways from the rise of AI. Because of this, I see it as the better AI stock over the long term.