Walmart (WMT -0.09%) and Alibaba (BABA 1.22%) are two of the world's largest retailers. Walmart operates more than 10,500 stores and warehouse clubs across 19 countries and a wide range of e-commerce websites. Alibaba owns Taobao and Tmall, the two largest e-commerce marketplaces in China, several overseas marketplaces, and more than 300 brick-and-mortar supermarkets. Alibaba also owns China's largest cloud infrastructure platform.

But over the past five years, Walmart's stock has rallied 85% as Alibaba's stock plunged 50%. Let's see why the American retailer outperformed its Chinese peer by such a wide margin -- and if it's still the better overall investment.

A person is showered with cash while using a laptop.

Image source: Getty Images.

Why did the bulls rush to Walmart?

Walmart was one of the few big box retailers that survived the retail apocalypse and kept pace with Amazon. Walmart remained relevant by upgrading its e-commerce and delivery capabilities, using its own brick-and-mortar stores to fulfill its online orders, and matching Amazon's prices and promotions.

Walmart also differentiated itself from competitors with a broad selection of private label products. It even rolled out its own Walmart+ subscription plan -- which offers free deliveries, discounts, and streaming video from Paramount+ -- to counter Amazon Prime, and it's in the process of buying the smart TV maker Vizio to challenge Amazon's Fire TV devices.

Walmart kept up with Costco Wholesale in the warehouse club market with its Sam's Club stores, and it expanded its overseas e-commerce presence by acquiring India's Flipkart and buying a stake in Alibaba's rival JD.com. All of those moves enabled Walmart to blossom as many of its industry peers withered.

In fiscal 2024 (which ended this past January), Walmart's revenue rose 6%, driven by its 5.6% comparable store sales (excluding fuel) growth in the U.S. and a 13.5% increase in its international sales. The company's adjusted earnings per share (EPS) grew 6%. Analysts expect its revenue and adjusted EPS to grow 4% and 6%, respectively, in fiscal 2025.

Based on those expectations, Walmart trades at a reasonable 26 times forward earnings and pays a forward dividend yield of 1.4%. That yield might seem low, but it's raised its payout annually for the past 51 consecutive years. It also bought back 17% of its shares over the past decade. All of those strengths make Walmart a great safe haven play.

Why did the bulls retreat from Alibaba?

Alibaba's growth was derailed by a mix of regulatory, competitive, and macro headwinds over the past three years. In 2021, China's antitrust regulators hit it with a record $2.75 billion fine and forced the company to end exclusive deals with merchants, limit aggressive promotional strategies, and seek the government's approval for any major acquisitions.

Those draconian restrictions eroded Alibaba's defenses against aggressive competitors like JD.com and PDD. China's economic slowdown, which was exacerbated by unpredictable COVID-19 lockdowns, added to that pressure. To make matters worse, Alibaba's cloud business struggled as companies reined in their software spending.

Meanwhile, U.S. regulators threatened to delist shares of Chinese companies that didn't comply with tighter auditing standards. Its CEO, Daniel Zhang, stepped down last year, and it split its business into six new units in hopes of spinning them off with fresh initial public offerings (IPOs). However, the company subsequently scrapped most of those IPO plans -- so it won't be able to raise a lot of cash through spin-offs as its sales growth slows down.

Alibaba's revenue only rose 2% in fiscal 2023 (which ended last March) as its adjusted earnings per American depositary receipt (ADR) grew 4%. But for fiscal 2024, analysts expect its revenue and earnings to grow 7% and 14%, respectively, as the stronger growth of its overseas marketplaces offsets its slower sales in China. Alibaba also expects its logistics subsidiary, Cainiao -- which it recently took full ownership of -- to drive its growth as it offers more of its services to third-party customers.

For fiscal 2025, analysts expect Alibaba's revenue and earnings to rise 8% and 1%, respectively. Those growth rates might seem anemic, but its stock looks dirt cheap at just 8 times forward earnings. It recently increased its current buyback authorization by $25 billion -- but it's only bought back about 1% of its shares over the past decade.

The better buy: Walmart

Walmart's stock looks more expensive, but the company isn't stuck in a hurricane of macro, competitive, and regulatory headwinds like Alibaba. Walmart could eventually shed its premium valuation as interest rates decline and investors pivot back toward growth stocks, but it's still a solid long-term investment. Alibaba might seem like a deep value play, but the company won't command a higher valuation until it resolves its most pressing issues.