What happened

Shares of Amazon (AMZN 1.40%) stock gained 14% in May, according to data provided by S&P Global Market Intelligence. It's building on the momentum of a public craze about the possibilities of artificial intelligence (AI), as management announced its own generative AI efforts back in March and then debuted several new AI-powered devices in May.

So what

Amazon had been losing some steam over the past year as sales growth decelerated in the aftermath of astronomical pandemic growth, and profitability has been pressured as demand slows. Even its reliable Amazon Web Services (AWS) division, which is a profit-generating machine, is feeling the pinch as business customers balance their budgets and curtail spending. 

But Amazon is doing one of the things it does best, which is invest in technology to dominate new sectors. It has been using AI (and machine learning) for years, since before it became the buzzword it is right now, for functions like predicting sales growth and managing inventory. In March, Amazon announced a collaboration with Nvidia to develop large language models, one of the foundations of generative AI. It recently launched several new AI-powered devices that upgrade its suite of products. These products, part of the Echo line, are Alexa-enabled.

Now what

Amazon stock lost 49% of its value in 2022 as it struggled with lighter sales and too much infrastructure and as investors lost confidence in its business. It also posted its first annual net loss in 10 years.

However, it's up 46% so far this year. Management is making practical efforts to improve the company's operational health, and Amazon is branching out into what could be lucrative new businesses. As investors get excited about the possibilities of AI, Amazon throwing its hat into the ring is generating more investor enthusiasm.

Whatever happens with AI, Amazon has demonstrated its ability to enter and take over new areas. It's moving in several directions, such as healthcare, which it's making a big bid for with its acquisition of One Medical, which went through in February. These open up new markets and create new growth opportunities.

Even with inflation, sales are still growing, and in the event of a return to a stronger economy, Amazon is well-positioned to get back to higher growth and reward shareholders over many years.