Don't call it a comeback, but e-commerce is finally a growth sector again. Investors avoided the industry thanks to a demand slump in late 2022 into early 2023 following huge gains during the pandemic.

Sales are rising again now, though, and that boost is helping stocks like Amazon (AMZN 3.43%) and Shopify (SHOP 1.11%) recover some lost ground. Both stocks are valued at a discount to where they were during the height of the pandemic, but which one is the better fit for your portfolio? Let's dive right in.

Buy Amazon for the services

In the long list of reasons why an investor might want to own Amazon's stock, e-commerce likely doesn't crack the top 5. More exciting factors supporting the business today include its services segment, which is becoming more valuable thanks to artificial intelligence (AI) tech. The AWS platform is still early on its growth curve, too, with many more years of gains ahead as businesses transition to cloud-based infrastructures.

Amazon isn't growing nearly as quickly as Shopify, to be sure. Amazon sales this year are projected to be roughly flat while most Wall Street pros expect an increase of over 20% for marketplace platform specialist Shopify.

Zoom into Amazon's services segment, and that picture changes, though. This division is responsible for over half of sales right now and is expanding much more quickly than the e-commerce unit. Amazon's service business is highly profitable and delivers cash flow that can be directed toward high-return growth investments. As a result, the stock could generate great returns as the operating profit margin breaks free from the low single-digit range in the coming years.

Buy Shopify for the innovation

Shopify stock offers a similarly strong outlook for rising profit margins and cash flow. Sure, you don't get the safety that comes with Amazon's over $500 billion of annual sales. But in exchange for that increased risk, there's potential to benefit from major improvements in Shopify's business over the coming years.

The business looks much different than it did just a year ago, after all. Shopify recently exited the logistics and fulfillment niche, which immediately reduced costs and allowed the company to focus on higher return areas around its platform services.

Merchants love the wider services offerings, which include big new revenue lines like payments processing, as illustrated by its surging subscription revenue. Investors are right to be excited about where Shopify's business is headed as it capitalizes on the software-as-a-service selling model in the coming years.

The better price

The biggest risk facing investors is just paying too high a price for these well-positioned businesses. That's more of a concern for Shopify, which is valued at 14 times annual sales. A growth stock investor could own tech giant Microsoft for a cheaper premium than that.

Amazon is priced at 2.7 times sales today, which is near its 2023 high. Yet investors were paying over 4 times sales before the pandemic struck.

That discount seems to make the tech giant a preferable choice here. You get exposure to excellent growth niches and rising profitability with Amazon. But you won't need to take on the risk associated with Shopify's less-established business. For most investors, then, Amazon is the better stock to buy today.