The consumer shift to digital payments and e-commerce is sure to produce wealth-building returns for investors over the long term. The worldwide e-commerce market was estimated to be worth $3.3 trillion in 2019. It is projected to reach nearly $5 trillion by the end of this year. By 2024, eMarketer expects that figure to reach nearly $6.4 trillion, which is remarkable given that we're talking about a shift of trillions in consumer spending.

There is more than enough opportunity in e-commerce to spread around. While there are several good stocks to consider here, there are not two companies better positioned to deliver market-beating returns than Etsy (ETSY -2.17%) and Amazon (AMZN -1.64%). Let's take a closer look at these two e-commerce operators.

A globe sitting in a shopping basket.

Image source: Getty Images.

1. Etsy: It has momentum and a long-term opportunity

Etsy has come a long way in the last five years. Revenue has increased more than sixfold to reach $2.1 billion on a trailing-12-month basis. The stock might look expensive with a $27 billion market cap and a price-to-earnings ratio of 62, but investors should look at Etsy's current momentum and its long-term opportunity. 

The company ended the second quarter of 2021 with revenue slowing to a 13% increase year over year, as it lapses the triple-digit percentage rates achieved during 2020, but it now has 90 million active buyers on its marketplace. That's an increase of 50% year over year in the second quarter, but the recent acquisition of Depop reveals that Etsy could expand into a pretty large business.

Depop is one of the leading shopping sites with Gen Z customers in the U.S., specializing in the resale of secondhand clothing. This is a market that is expected to grow 11 times faster than retail clothing over the next five years. 

Etsy paid $1.6 billion for Depop in July, which could be a bargain down the road given that Depop's gross merchandise sales grew at a compound annual rate of 80% between 2017 and 2020. 

The U.S. secondhand market is estimated to be worth $77 billion, which is 77% of Etsy's previously estimated addressable market for the special handmade items that its sellers are known for on the marketplace. Looking at it another way, Etsy paid $1.6 billion to nearly double its growth opportunity. That's one great reason to buy this top e-commerce stock.

2. Amazon: Still quite capable of expansion

Etsy offers investors high-return potential over the long term, but there is a good case to be made that Amazon is the only e-commerce stock you need. It has a growing base of more than 200 million Prime members and generates $443 billion in trailing-12-month revenue. Just as it's nearly impossible to dethrone Walmart's formidable retail ground game with 3,570 supercenters, it's equally difficult to outdo Amazon's 390 million square feet of fulfillment space and data centers. 

Of course, Amazon is not only about retail. Most of its operating profit comes from its cloud services business Amazon Web Services. The company saw its cloud business accelerate last quarter to a 37% year-over-year growth rate, as businesses also accelerate their migration to digital services coming out of the pandemic. AWS generated $52 billion in revenue over the last four quarters, but it will very likely become a larger business, since the cloud computing market is expected to be worth $791 billion by 2028, according to Fortune Business Insights. 

We also can't forget about Amazon's growing entertainment assets, which are increasingly a key gateway into Prime membership for millions of customers around the world. A year ago, one analyst estimated that these assets, including Prime Video, Prime Music, and the Twitch game-streaming platform, could be worth $500 billion overall. 

Amazon's $1.8 trillion market cap gives the perception that it's too late to invest in the stock. However, at a trailing revenue growth rate of 27%, Amazon is still capable of expanding quite fast relative to most companies. Moreover, there are still trillions of dollars of consumer spending yet to migrate over to online shopping. 

Amazon's stock trades at a price-to-sales ratio of just over 4, or 30 times its trailing cash from operations per share. Those are not expensive valuation multiples for a business of Amazon's quality and growth prospects. At a market cap approaching $2 trillion, Amazon just might be undervalued.