Investors could hardly be more optimistic about Amazon (AMZN 0.08%) these days. The stock has gained nearly 50% so far in 2023, trouncing the rally in the wider Nasdaq Composite index. Wall Street pros keep raising their expectations, in part because of the declining risk that a recession will severely impact earnings over the next year or so.

But that level of optimism isn't ideal for creating compelling stock valuations. So, let's take a look at whether prospective investors still have a good chance at seeing excellent returns by holding Amazon stock over the next several years.

Latest results

The business is expanding at a decent clip right now, especially considering its massive size. Revenue in the selling period that ran through late March rose 9%, or roughly even with the prior quarter's rate.

Dig a bit deeper, though, and you'll see sharp differences in Amazon's major selling divisions. Its e-commerce platform was essentially flat at $56 billion. In contrast, the services segment is growing quickly thanks to strong demand in areas like Amazon Web Services, Prime subscriptions, and third-party advertising sales. Executives credited some of that growth to innovations like artificial intelligence (AI). "There's a lot to like about how our teams are delivering for customers," CEO Andy Jassy said in a press release.

Cash and profits

Amazon's net earnings metric often swings wildly, and this past quarter it shifted from a $3.8 billion loss to a $3.2 billion gain. Yet investors should play closer attention to the long-term trend in cash flow, which is decidedly positive. Following a period of over-investing in the delivery network after the pandemic, Amazon has reduced its rate of expenditures now. The business is moving back toward $60 billion in annual operating cash flow, in fact.

AMZN Cash from Operations (TTM) Chart

AMZN Cash from Operations (TTM) data by YCharts

Success here is important because it provides the business with ample resources to invest in long-term growth opportunities like e-commerce, cloud services, and AI. One of the most attractive aspects of owning Amazon stock is that a shareholder can benefit from all of these varied long-term capital investments simply by holding shares and letting a few of them drive overall returns.

Price and value

The good news is that investors don't have to pay a huge premium to gain exposure to all of these benefits. Amazon stock is valued at about 2.5 times sales right now, down from nearly 5 at the pandemic peak. Sure, you could have bought the stock at a lower valuation a few months ago when Wall Street was more worried about an imminent recession. And there are faster-growing businesses that aren't as capital intensive. Microsoft is just one great example. It will be another few quarters at least until Amazon is able to get costs fully back in line with shifting demand trends.

But Amazon has a dominant position in several attractive growth niches, generates ample cash, and is productively deploying that capital into industries that should grow for decades. As a result, shareholders are likely to see good returns from owning this stock over the long term.