Amazon (AMZN 3.43%) is the top e-commerce company in the world. Its Prime Day and Black Friday sales often serve as indicators for how well the global economy is doing. Moreover, it's been a fantastic growth stock. A $20,000 investment in it 20 years ago would be worth more than $1.1 million today.

But as well as it has performed over the long haul, it has slowed down in recent years. There's another stock, also involved in e-commerce and tech, that has been an even better buy of late, and that's Shopify (SHOP 1.11%).

Routinely outperforming Amazon since 2016

Shopify went public in 2015 and has been red-hot ever since. Aside from 2022, when the markets as a whole struggled, Shopify has delivered consistently positive returns since 2016 (its first full year on the market). And it has also done better than Amazon in almost every one of those years.

Chart showing AMZN vs SHOP returns by year.

Source: YCharts. Chart by author.

What has made Shopify successful is its ability to help anyone become an online vendor quickly and easily. For a recurring fee, it will help any business set up and manage an online shop to sell its goods and services all over the world. And there is no need to go onto a different platform, such as Amazon, to sell those items. Merchants can do so right on their own websites.

The proof is in the growth rate

The ease of use and attractiveness of Shopify's services have enabled it to be a big player in e-commerce. And a big reason for the stock's superior returns over Amazon in recent years is that its growth rate has also been significantly higher.

AMZN Revenue (TTM) Chart

AMZN revenue (TTM) data by YCharts. TTM = trailing 12 months.

The advantages Shopify has are that as a smaller company, it takes much less growth in absolute terms to provide it with faster growth on a percentage basis, and it has more room to expand its footprint, especially in a massive industry such as e-commerce. Its revenue over the past four quarters totaled $6.7 billion, while Amazon generated more than $554 billion in sales during the same period.

Investors' hopes that Shopify will become the "next Amazon" are likely a key reason why the stock has performed so well and been such a hot buy. But even today, its market capitalization is just under $100 billion -- nowhere near the $1.5 trillion market cap of Amazon.

Is Shopify a better stock?

Both Shopify and Amazon are attractive growth stock options for investors to consider for the long haul, and it would be hard to go wrong with either one for your portfolio, especially as the global economy grows.

But I do believe that Shopify can continue to outperform Amazon. Over the years, Amazon has been diversifying into industries like healthcare and video streaming in an effort to expand its growth opportunities. But I think by focusing primarily on e-commerce, Shopify could produce better results in the long run.

If you want to buy only one of these stellar e-commerce stocks, then buy Shopify. But there would be nothing wrong with investing in both.