Amazon's (AMZN 0.58%) stock has been on fire lately. Year to date, it has surged by 61% to $138 as investors gain more confidence in Amazon's prospects, thanks to its better-than-expected performance.

But for those who have not bought the stock, is it too late to consider it now? Let's explore this further in this article.

Shopper thinks before buying online.

Image source: Getty Images.

A quick review of Amazon's recent performance

2022 wasn't a great year for e-commerce companies. The reopening of global economies post-COVID-19 lockdowns and a generally weak economy negatively impacted the prospects of e-commerce players, including Amazon.

Investors were largely pessimistic, which explained the more than 50% decline in Amazon's stock in 2022 from its peak in 2021. Yet, Amazon's latest performance provided hope that investors could have been overly pessimistic about the company.

Here are some important figures to consider. Revenue grew 11%, with growth coming in strong across all markets. Operating profit more than doubled to $7.7 billion amid top-line growth and various cost-cutting activities. Operating cash flow surged 74% to $62 billion for the trailing 12 months – as a result, free cash flow improved to an inflow of $8 billion for the trailing 12 months, compared to an outflow of $24 billion.

In short, Amazon delivered a great quarter with a respected improvement across revenue, profits, and cash flow. Yet it is not what investors expected to see in a "challenging period."

A quick overview of Amazon's prospects.

One of the biggest concerns investors have about Amazon is whether it can continue growing, given its humongous size. The company generated $134 billion in revenue in the latest quarter.

The good news is that there are good reasons to be optimistic about Amazon's prospects in the near and longer term. Let's start with the former. After delivering a solid result in the second quarter of 2023, the company guided revenue to grow by 9% to 13% and operating profit to reach $5.5 billion to $8.5 billion in the third quarter.

Long term, Amazon can still expand its e-commerce and cloud computing business. Take e-commerce, for example. While the company is the undisputed leader in the e-commerce industry with around 38% market share, it has less than 10% of the total retail market in the U.S. -- the e-commerce share of total U.S. retail sales was 15.4%. If Amazon can continue to delight its loyal Prime users with a wide selection of low-priced products and outstanding services -- fast delivery, free videos, etc. -- it stands a good chance of increasing its retail market share in the long run.

Besides, Amazon's cloud computing is well positioned to sustain its growth for years, if not decades, riding on mega-tailwinds like the ongoing migration to the cloud and the development of artificial intelligence (AI). With a 32% market share in the global cloud infrastructure market, the tech company has an enormous scale advantage, allowing it to offer customers competitively priced cloud services and still make good profits for itself.

Long story short, this elephant can still dance. Amazon's growth prospects are impressive for a trillion-dollar business.

A quick overview of Amazon's valuation

Amazon might have good prospects, but investors should not overpay for its stock to get a margin of safety and an adequate return.

And the good news is that Amazon's stock remains reasonably priced even after its price increase. For example, the stock has a price-to-sales (P/S) ratio of 2.7, lower than its five-year average of 3.5. Comparatively, Shopify has a PS ratio of 13.5.

In other words, investors are getting a reasonably good deal if they buy Amazon's stock at today's valuation.

So, is Amazon stock a buy?

Amazon is a well-established, large company that has good growth prospects.

While it is not realistic to expect the company to sustain its historically high double-digit growth rates forever, the company can still grow at respectable rates, riding on the continued e-commerce and cloud computing penetration in the years to come.

Besides, the stock trades at a reasonable valuation, making it a relatively safe long-term bet.

All that being said, Amazon's stock remains a buy.