Amazon (AMZN 0.58%) has been one of the hottest mega-cap stocks on the market. Its shares have soared nearly 20% year to date and are up more than 70% over the last 12 months.

The company revealed in its first-quarter update on Tuesday that it plans to increase capital expenditures in the coming quarters. Does this increased spending diminish Amazon's prospects? Nope. Here's why it makes the stock an even better buy.

Near-term spend, long-term win

Amazon CEO Andy Jassy stated in the company's Q1 conference call that capital expenditures would "meaningfully increase year over year" in 2024 to support growth for its cloud unit, Amazon Web Services (AWS), especially in generative AI. CFO Brian Olsavsky noted that capex in Q1 was $14 billion. He said that's likely to be the lowest quarterly level this year. With 2023 capex totaling $48.4 billion, Amazon will increase its capital expenditures by at least 16%.

Investors reacted negatively to Meta Platforms' similar announcement in its Q1 update that it planned to boost capex because of its focus on artificial intelligence (AI) and metaverse initiatives. However, Amazon projected higher spending, and its shares rose. Why? I think there are two reasons.

First, Amazon generates more than enough free cash flow to afford the higher capex. The company's free cash flow topped $50 billion over the trailing 12 months ending March 31, 2024. That's a huge improvement from the outflow of $3.3 billion for the trailing 12 months ending March 31, 2023.

Second, investors believe Amazon's capex investments will pay off. They know that history is on their side. As Olsavsky noted in the Q1 call, when Amazon has increased capex for AWS in the past, it has benefited from increased revenue, operating income, and free cash flow for a long time afterward.

Don't underestimate Amazon's AI prospects

Deepwater Asset Management co-founder Doug Clinton recently told CNBC that investors shouldn't "expect Amazon to be a major player" in the AI model wars over the next three to five years. I don't take issue with that comment. However, don't read more into Clinton's remarks than he intended -- and don't underestimate Amazon's AI prospects.

Amazon's strategy has been to offer customers more alternatives on AWS rather than push its own large language model (LLM), although it does have an in-house AI model. Notably, Amazon Bedrock allows customers to use Anthropic's Claude 3 LLM, which is arguably the best AI model available right now. Customers can also use Meta's Llama 3, several Mistral models, and Cohere's latest models.

I like how Amazon makes it easy for organizations to train and deploy generative AI on AWS. If a customer wants to use Nvidia chips, AWS has, in Jassy's words, "the broadest selection of Nvidia compute instances around." Want a more cost-effective alternative? AWS offers its own AI chips.

Amazon's SageMaker dramatically improves productivity in building generative AI models. As two cases in point, Jassy noted in the Q1 call that SageMaker enables Perplexity AI to train its LLMs 40% faster and Workday to reduce inference latency by 80%. He also highlighted Custom Model Import, which allows customers to import AI models from SageMaker or other tools into Bedrock before deploying apps.

Perhaps the most important recent example of Amazon's AI prowess is its launch of Amazon Q. This AI-powered tool generates and debugs software code. Jassy said that Q "has the highest-known score and acceptance rate for code suggestions, outperforms all other publicly benchmarkable competitors and catching security vulnerabilities, and leads all software development assistants on connecting multiple steps together and applying automatic actions." Impressive.

An even better buy

I've viewed Amazon as a smart pick for quite a while. The company's cost-cutting initiatives are paying off nicely. It has new growth drivers, especially advertising.

But Amazon's investment in preparing AWS to handle greater generative AI demand makes me even more optimistic. I fully expect this investment to deliver significant returns. Amazon has been a great stock to buy. Now it's an even better one.