It's not so hard to find COVID-19 winners. While many businesses have been on the unfortunate side of the pandemic, others were poised to skyrocket as people stayed home.

But while e-commerce came out on top, many essentials stores stayed open and served their customers. So while Amazon (NASDAQ:AMZN) proved its mettle again in 2020, Costco (NASDAQ:COST) made a formidable showing, even in e-commerce. Let's take a look at which one is the better buy.

Prepared for a pandemic

Amazon is the most trusted name in e-commerce. According to Statista, it accounts for half of all U.S. e-commerce, standing out in a crowded field. Despite its top spot, it keeps growing, with sales increasing 37% in the third quarter ended Sept. 30, and earnings tripling.

Exterior of an Amazon Go store.

Image source: Amazon.

Costco is one of the largest storefront retailers in the U.S., with $163 billion in 2020 annual sales and increasing. In the 2021 first quarter ended Nov. 22, comps increased 15% and digital sales rose 86%. Those stellar results happened after most lockdowns were lifted, demonstrating the company's ability to perform well in all types of environments. 

It regularly posts around a 90% member retention rate and millions of new members annually. Membership fees alone contributed almost $1 billion in the first quarter.

Both companies were well-positioned to increase sales over the past few months as customers stayed home and ordered or went to the few essentials retailers that were allowed to remain open. But that doesn't mean growth is over when the pandemic is.

Meeting demand in new areas

While Costco has successfully embraced digital shopping, Amazon has had less success with storefronts. But it's improved its store model and now has 26 Amazon Go stores that offer meals and snacks, and two Go grocery stores where customers can simply take what they want and walk out without waiting on any lines. It also now has seven Amazon Fresh grocery stores, which combine a physical and digital experience, including free same-day delivery for Prime members and Dash cart, another way to skip the checkout line.

Girl holding a bulk-sized bag of carrots in a grocery store.

Image source: Getty Images.

Some of Costco's operating segments are still closed or not running at full speed, such as travel, and as they reopen they will add to Costco's already impressive sales. It's managed to make all of that money with only 803 warehouses globally, including 558 in the U.S. It opened eight new locations in the U.S. in the first quarter and expanded its global presence, where it now has warehouses in 11 international countries.

Amazon has moved beyond retail e-commerce into Amazon Web Services, which accounted for 12% of total revenue in the third quarter but more than half of total earnings. It continues to rack up customers for the high-margin business, adding Star Alliance and more services for Twitter in December.

It's hustling into many other new areas as well. It already has award-winning content in Amazon Prime Video, and has its own music streaming service. It launched Amazon Pharmacy in November to disrupt the prescription drug market, and The Wall Street Journal reported that it is in talks to acquire podcast maker Wondery.

In Costco's favor, it also pays a dividend, which Amazon does not. The yield is a below-average 0.72%, but the company also pays a periodic special dividend that makes it much more valuable -- including $10 in November 2020.

Where should investors place their bets?

Amazon and Costco are both excellent companies with opportunities for further growth, and I would recommend either one. But pitched against each other, I'd go with Amazon, because it has a more intriguing case for high growth. Amazon shares trade for almost 10 times Costco's, and if that puts it out of your league, Costco is still a great choice.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.