Everyone wants a piece of the artificial intelligence (AI) market. Since OpenAI made a significant breakthrough with the launch of ChatGPT, the industry has attracted considerable attention from corporations. None has benefited from it more than Nvidia, and although the chipmaker is an excellent investment, my favorite AI stock to buy and hold is Amazon (AMZN 0.26%).

A person packing shipping boxes.

Image source: Getty Images.

AI and so much more

One reason Amazon is an attractive stock is that its business is significantly diversified beyond AI. That can allow the company to perform relatively well even as this unit faces headwinds, or, for that matter, when economic issues hit.

Amazon is a leading grocery chain, for example. The company also has the top share in the U.S. e-commerce market. Last year, a study by an independent company found that Amazon was the cheapest online retailer -- it was the eighth consecutive year the company earned this rating.

Combine that with the fact that Amazon offers all kinds of perks, including one-day shipping and easy returns, and you've got a recipe for success, even when there is a downturn. It's not that Amazon won't be affected. It's that the company is more resilient than most of its peers.

Of course, Amazon's cloud computing arm, Amazon Web Services (AWS), remains one of its biggest growth drivers and sources of profits. The tech giant offers various AI-related services through AWS, helping boost this already high-performing segment. Here's the good news: There is significant room to grow for AWS. As CEO Andy Jassy pointed out during the first-quarter earnings conference call, "More than 85% of the global IT spend is still on premises, so not in the cloud yet."

As more of that spending migrates to the cloud, Amazon should be one of the biggest winners, considering its leading position in the cloud computing market. That shift could take a while, so Amazon could ride this wave for a long time. AWS boasts a $117 billion annual run rate -- for context, Amazon's net sales last year came in at $638 billion.

AWS' success is great, but Amazon isn't just offering AI services through the cloud. The company is implementing various applications of the technology across its business. According to Jassy, Amazon has more than 1,000 AI applications, including with its next-gen virtual assistant Alexa Plus, within its advertising business, fulfillment network, etc.

The company believes AI can help it improve customer service. Expect Amazon to become increasingly efficient as it continues to roll out AI initiatives across its operations.

Amazon hasn't peaked

Amazon is one of the largest companies in the world by almost any meaningful metric. It has a market cap of about $2.3 trillion. Though some might think that means the company doesn't have much room to grow anymore, nothing could be further from the truth. Amazon's growth opportunities beyond AWS and AI include its advertising business. The company has one of the most visited websites in the world, so it is naturally an excellent target for businesses looking to reach customers, especially since they can sell directly on the platform.

Amazon's advertising unit generated $13.9 billion in revenue in the first quarter, increasing 18% year over year, a faster growth rate than even AWS. The digital advertising market still has miles of growth left.

It's worth noting that Amazon's fastest-growing segments, advertising and AWS, also tend to be higher-margin businesses than the company's legacy e-commerce services. So, as they capture an increasingly larger share of Amazon's top line, that should lead to stronger profits and margins.

Lastly, Amazon has a vast ecosystem of about 200 million Prime members. The company can offer its loyal customers a range of services and subscriptions.

The recent success of Amazon Pharmacy is a good example. A membership is not necessary for the service, but it does grant users a range of savings and shipping-related perks. Amazon is already disrupting the U.S. pharmacy landscape and putting pressure on well-established retailers.

That says a lot about the company. Between AI, AWS, advertising, and an installed base to which it can sell more services, Amazon has ample growth avenues and a more diversified business than most of its peers. The stock should still deliver superior returns over the long run. For these reasons, Amazon is my top AI stock to buy and hold forever.