This has been the year of comebacks for technology stocks. One prime (pun intended) example is Amazon (AMZN -1.44%). The e-commerce and cloud computing behemoth saw its shares fall over 50% from all-time highs in 2022 due to profit struggles and slowing growth post-pandemic. Now, in 2023, the stock soared over 70% to a market capitalization of $1.48 trillion, well outpacing returns for the S&P 500.

If you have remained on the sidelines, you may think you've missed the boat buying shares of Amazon. But that couldn't be further from the truth. Here's why Amazon shares still look cheap today and could provide market-beating returns for investors over the next five years.  

AMZN Chart

AMZN data by YCharts.

Demonstrating power in retail

The best way to look at Amazon is to separate it into three segments: North American retail, international retail, and Amazon Web Services (AWS). The North American retail segment struggled to generate a profit in recent years, which is a big reason the stock is off from all-time highs. Over the last 12 months, operating margins were right around 0%.

At first glance, this is concerning, but there is a reasonable explanation for the profit woes. During the pandemic, Amazon accelerated its build-out of warehouses, delivery vans, and other e-commerce supply chain infrastructure in order to keep up with customer demand. This lowered margins in the interim but has set up Amazon to dominate North American e-commerce over the long haul. With tens of billions of capital expenditures spent on e-commerce in the last few years, the company's vertically integrated network now may be impossible to replicate.

Before the pandemic, Amazon's North American segment hit operating margins of around 5%. In the next few years, I think these levels will be greatly surpassed due to a mix-shift in where Amazon gets its revenue. Specifically, the company gets much more in sales from third-party sellers, advertising, and subscription services, all of which come with higher profit margins. For example, over the last 12 months, Amazon's high-margin advertising revenue was $39.3 billion compared to just over $10 billion pre-pandemic. 

With a better revenue mix, it is likely Amazon's North American segment could hit 10% profit margins sometime within the next few years, if not higher. With revenue growing at 10% a year, the segment should hit around $430 billion in revenue three years from now. That would equate to $43 billion in annual operating income for Amazon's North American unit.  

Web Services still has more growth ahead

AWS has been the big profit generator for Amazon in recent years. The leading cloud infrastructure provider generated $83 billion in revenue over the past 12 months and $21.5 billion in operating income for a profit margin of 25%. Investors have been concerned about slowing growth, with revenue "only" up 16% year over year last quarter. That is missing the forest through the trees, though.

Customers of AWS pulled back spending and tried to save costs in recent years with the software market in a downturn. AWS also targets start-ups for new customers, which have seen a big decrease in funding in recent quarters. Despite this, the unit is still growing revenue at over 15% year over year and is poised to continue growing with the cloud computing market in the early innings. The industry is expected to grow sales at a 14% rate until 2030, a massive tailwind that AWS can benefit from.

If AWS can grow revenue by 15% for the next three years and keep its 25% profit margin, it will hit $31 billion in earnings three years from now. 

The wild card: International

The last Amazon segment is its international operations, which cover countries such as India, Japan, and Mexico. This unit has been unprofitable for years, generating negative 6.5% margins over the last 12 months. There is a lot of uncertainty for this segment, but if it can follow the same trajectory as the North American business, it should have many years left to grow and hit a profit inflection within the next few years. It is hard to predict what sort of margins the segment will have, though.

Exclude the international segment, and Amazon looks on track to generate around $75 billion in earnings from its combined North American and AWS segments three years from now. I wouldn't be surprised if these estimates prove to be conservative either, given how fast its high-margin revenue segments are growing. Compared to a market cap of $1.48 trillion, that would give Amazon a price-to-earnings ratio (P/E) of 19, which is below the S&P 500 average of 25.

Add on the potential of the international segment and industry tailwinds in e-commerce and cloud computing, and I would expect Amazon shares to trade at a premium to the market average three years from now. This makes me confident that -- even after a 70% rise in 2023 -- Amazon stock should provide solid returns for shareholders over the next few years.