Amazon (NASDAQ:AMZN) and Lululemon (NASDAQ:LULU) both outperformed the S&P 500's near-40% rally over the past five years by a wide margin.

Amazon's stock surged 450% as its e-commerce and cloud businesses locked in customers and crushed competitors. Lululemon's stock rallied 240% as its premium yoga and athleisure apparel retained a loyal base of higher-end shoppers.

But 2020 has been a tougher year for Lululemon, which closed its stores and suspended its buybacks to deal with the COVID-19 crisis. Meanwhile, Amazon's e-commerce and cloud businesses continued growing, as stay-at-home measures forced more people to shop online and access more cloud-based services.

A boy draws "buy and sell" arrows on a small blackboard.

Image source: Getty Images.

Does Amazon's resilience make it a stronger overall investment than Lululemon? Or will Amazon's gains fade as the costs of operating through the COVID-19 crisis throttle its earnings growth? Let's take a deeper look at both companies to decide.

How do Amazon and Lululemon make money?

Amazon generated 61% of its revenue from its North American businesses last year. 27% came from its international businesses, and the remaining 12% came from AWS (Amazon Web Services), the world's largest cloud infrastructure platform.

Yet AWS generated a whopping 63% of Amazon's operating profits during the year. The rest came from its North American business, while its international business remains unprofitable. Amazon subsidizes the growth of its lower-margin marketplaces with its higher-margin cloud platform business -- which widens its moat against brick-and-mortar retailers.

Lululemon generated 72% of its revenue in the United States last year, another 16% from Canada, and the remaining 12% from other overseas markets. By channel, 63% of its revenue came from company-operated stores, 29% came from direct-to-consumer platforms, and nearly 9% came from "other" sources like wholesale channels and seasonal stores.

Lululemon locks in customers and nurtures brand loyalty with free yoga classes and community events. Last year, it claimed its "Power of Three" growth plan could generate double-digit annual revenue growth through the end of 2023 by doubling its men's revenue, doubling its digital revenue, and quadrupling its international revenue.

How fast are Amazon and Lululemon growing?

Amazon's revenue and earnings grew 20% and 14%, respectively, last year. Its sales rose 26% annually in the first quarter, but its EPS dropped 29% as it racked up $600 million in pandemic-related expenses to keep workers and shoppers safe.

Amazon expects those costs to surge past $4 billion in the second quarter. As a result, it expects its revenue to rise 18%-20% annually during the quarter, but for the midpoint of its operating income to drop to nearly break-even levels, which will likely trickle down to a net loss. However, Amazon continues to hire new workers, which suggests it will keep scaling up its business through the crisis as many of its weaker brick-and-mortar rivals struggle to stay solvent.

A group of women attend a yoga class.

Image source: Getty Images.

Lululemon's revenue rose 21% last year as its EPS rose 37%. It's generated nine straight quarters of double-digit comparable store sales growth, but it declined to provide any guidance for 2020 -- which suggests its "Power of Three" strategy could hit some speed bumps as it temporarily closes its stores.

But unlike many other retailers, which furloughed their employees without pay or benefits, Lululemon will pay protection for its employees through June 1. The company also established a fund to aid Lululemon employees throughout the crisis.

Lululemon's cash and equivalents grew 25% to $1.1 billion at the end of 2019, and it doesn't have any long-term debt. That robust balance sheet, along with its strong digital business, should help it weather the incoming storm. Amazon ended last quarter with $49.3 billion in cash and equivalents, making it one of the most cash-rich tech companies in the world, but it was still shouldering $24.8 billion in debt.

Which stock is the better investment?

Amazon and Lululemon should both emerge from the crisis as stronger companies, but Amazon faces more direct competitors than Lululemon: Walmart and Target are gaining ground against its e-commerce business, and Microsoft's Azure threatens AWS' long-term growth. It could be tough for Amazon to counter those threats as it plows more money into COVID-19 safety measures, and Amazon's forward P/E of nearly 80 looks lofty relative to its earnings growth.

Lululemon faces competition from Gap's Athleta, Nike, and Adidas, but none of those rivals throttled its double-digit comps growth over the past two years. That resilience indicates that Lululemon has a fiercely loyal base of shoppers -- and they'll likely rush back to its stores after lockdown measures end. Lululemon's stock also isn't cheap at 50 times forward earnings, but the strength of its core business could justify that premium valuation.

The winner: Lululemon

Lululemon was a "best in breed" apparel retailer prior to the pandemic, and its strengths could become even more apparent after the crisis ends. Therefore, I'd rather buy shares of Lululemon than Amazon, which still faces resilient rivals in the e-commerce and cloud markets, as a long-term play in this rough market.

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.