Amazon (AMZN 0.58%) has been one of the best stocks over the past decade, turning every $10,000 invested into nearly $80,000. And before the stock's decline in 2022, that investment was worth nearly $150,000.

So what happened? Well, investors got worried about Amazon's over-expansion and its transition from a cash-generating company back to one that incinerates it. This is a valid concern, but one metric indicates that Amazon's stock could be a sleeping giant, just waiting to explode higher.

E-commerce boosted Amazon in 2021 and hurt it in 2022

Amazon, the world's largest e-commerce company, enjoyed a massive business boost during the pandemic when consumers looked online to get their everyday goods instead of venturing out to a store. To deliver, Amazon stood up multiple warehouses and significantly expanded its personnel to handle the load.

However, the good times didn't last, and once restrictions eased, many consumers resumed their old habits. According to another e-commerce leader, Shopify, e-commerce adoption reverted to its average trendline in 2022.

Chart showing e-commerce adoption in the U.S.

Image source: Shopify.

Still, the long-term trend is a bullish one for e-commerce adoption, and Amazon's growth is starting to reflect that, at least domestically. In the fourth quarter, Amazon's net sales (from the North American commerce business) were up 13% to $93.4 billion. Digging in a bit deeper, Amazon's online stores (the products Amazon itself sells) were down 2% year over year, while its third-party seller services were up 20%.

As Amazon continues experiencing this growth, the investments in its warehouse infrastructure will pay off. This should lead the all-important metric -- free cash flow -- to continue trending in the right direction.

Amazon's free cash flow has significantly improved, but it has a ways to go

The one metric that is likely to turn Amazon's stock around is free cash flow, or how much cash a company generates through its normal operations, less investments in property, technology, and equipment. This metric reached a historic low in the second quarter of 2022, but it has steadily improved since then.

Quarter TTM Free Cash Flow QOQ Rise
Q2 2022 ($23.5 billion) N/A
Q3 2022 ($19.7 billion) 36%
Q4 2022 ($11.6 billion) 46%

Data source: Amazon. TTM = trailing 12 months. QOQ = quarter on quarter.

Although trailing free cash flow was still negative in the fourth quarter, management has done a phenomenal job steering the ship in the right direction. Cost-cutting efforts (including layoffs) have worked well for Amazon, but investors will want to see continuous improvement throughout 2023.

If that trend plays out, the stock has tremendous upside.

Trading at below 2 times sales, Amazon is valued at the lower end of its price-to-sales range over the past 20 years.

AMZN PS Ratio Chart

Data by YCharts.

This valuation doesn't make a lot of sense, especially considering a high-growth, high-margin business like Amazon Web Services (its cloud-computing segment) didn't make up 16% of Amazon's top-line in 2014, the last time the stock traded this low.

If Amazon can get its cash flow on track, the stock has a lot of room to run. Management has been taking steps in the right direction, and it can still be one of the top big-tech stocks of 2023.