The returns from these two leading retail brands prove that you can find great investments by looking at the brands you use every day.

A $1,000 investment in Amazon (AMZN -1.64%) would have turned into $8,600 over the last 10 years. Amazon has an army of over 200 million Prime members that paves the way for growing annual revenue.

Meanwhile, Costco Wholesale (COST 0.17%) proves that investing in simple, easy-to-understand businesses can earn big returns, too. The same investment in the stock 10 years ago would have grown to be worth over $4,000 today, compared to just $2,500 in the S&P 500 index.

So which of these stocks is the better buy right now?

Amazon leads the e-commerce race

Retail spending has been gradually shifting to e-commerce for many years, and no company capitalized on that shift better than Amazon. Even with the e-commerce market slowing down recently over inflation and other headwinds, it still represents just 15% of total retail spending in the U.S. and remains a huge market opportunity, valued over $5 trillion and growing.  

Amazon is continuing to invest in doubling down on convenience and selection to keep Prime members satisfied and loyal for the long term. It recently introduced a pharmacy service to go along with Prime Video and other perks for Prime members. This incentivizes customers to look for reasons to shop Amazon throughout the year.

Amazon did something very impressive to further bolster its advantage: It spent the last few years building a transportation network as big as that of UPS to speed up delivery. That speaks volumes about Amazon's dominance and competitive advantage.

One reason Amazon can build something of that scale in a short period of time is the profits it earns from its nonretail businesses. Without its cloud services business, Amazon wouldn't have reported a profit last quarter. Amazon Web Services generated an operating profit of $5.1 billion in the first quarter, which offset the losses in the rest of the business. 

Other high-margin businesses are starting to gain traction, such as advertising services, which is nearly a $40 billion annual business. Third-party merchants want to get their products in front of Prime shoppers, which is turning into a lucrative business.

It's clear Amazon is getting stronger, making it a good investment choice for the long haul.

Costco has perfected discount retail

Despite two decades of perfecting e-commerce, Amazon still can't match Costco on price and value. There is a fundamental difference between these two businesses that makes Costco stand out in the retail industry.

Costco doesn't try to sell everything its customers might want to buy, like Amazon does. It buys in bulk volume across a limited number of items. This strategy lends itself to selling merchandise that is in high demand and will turn over quickly.

Most of Costco's profit doesn't come from sales of goods but from its membership fees. The business is structurally built to deliver savings to the customer, whereas Amazon is primarily competing on offering customers convenience. Obviously, investors are going to more highly value the business that delivers more savings during times of economic distress, which is why Costco stock has outperformed over the last year.

AMZN Chart

Data by YCharts

Both Amazon and Costco are experiencing slowing growth, however. Costco's comparable-store sales growth decelerated to 5.2% last quarter, down from 13% in the same quarter two years ago.

Amazon reported 9% year-over-year growth in the first quarter, well off its historical pace. Both companies should see better growth as inflationary headwinds blow away.

Should you buy Amazon or Costco?

On valuation and growth prospects, Amazon is the better buy. Its fast-growing nonretail businesses will give it an edge in delivering superior growth to drive shareholder returns, as it has over the previous decade.

While Amazon looks expensive, trading at a forward price-to-earnings ratio of 73 and a price-to-sales (P/S) multiple of 2.24, it could be undervalued. The stock is trading at its cheapest P/S multiple in nearly a decade, but it should command a higher premium when the market is in a better mood. 

It's the opposite for Costco. At its current P/S multiple of 0.93, Costco has never been this expensive. This is a danger sign that the warehouse club operator is overvalued. Amazon deserves to trade at a higher P/S multiple because of its higher-margin services growth, but a multiple close to 1.0 is expensive for a low-margin business like Costco.

COST PS Ratio Chart

Data by YCharts

It's worth noting that Warren Buffett's Berkshire Hathaway sold its entire Costco stake a few years ago, while adding a small position in Amazon.   

At a lower valuation, Costco would be a great option. But Amazon is the better investment right now.