Dollar Tree (NASDAQ:DLTR) and Walmart (NYSE:WMT) both survived the retail apocalypse, which crushed many brick-and-mortar retailers over the past decade. But over the past five years, Walmart's stock rallied nearly 80% as Dollar Tree's stock rose just over 10%.

Let's see why Walmart outperformed Dollar Tree -- and why I believe the superstore remains the better overall investment than the dollar store chain.

Understanding their core businesses

Dollar Tree, which sells all its namesake banner's products for a dollar, has carved out a defensible niche against Amazon among low-income shoppers. It acquired its rival Family Dollar, which sells products at slightly higher prices, in 2015.

A grocery cart in a supermarket aisle.

Image source: Getty Images.

Dollar Tree's acquisition of Family Dollar got off to a rough start, since the banner was more heavily exposed to competition from Amazon, Walmart, and other discount retailers. However, Dollar Tree reversed those declines over the past year by renovating its stores, adding $1 Dollar Tree sections, and selling alcoholic beverages.

Walmart once struggled against Amazon, but it renovated its stores, matched Amazon's prices, expanded its e-commerce ecosystem, and used its brick-and-mortar stores to fulfill online orders. Those aggressive strategies initially throttled its earnings growth, but widened its moat and ensured its long-term survival in the cutthroat retail market.

Unlike Dollar Tree and Family Dollar, which are only based in the U.S. and Canada, Walmart operates its namesake superstores and Sam's Club warehouse clubs worldwide. Its top markets include the U.S., the U.K., Mexico, China, and India, and it generated 23% of its revenue overseas last year. Walmart also owns a major stake in JD.com (NASDAQ:JD), China's largest direct retailer, and a controlling stake in Indian e-commerce giant Flipkart.

Why did Walmart outperform Dollar Tree?

Walmart's revenue rose 2% to $524 billion last year, with 2.8% comparable store sales growth at its U.S. stores, as its adjusted EPS dipped less than 1%.

Shoppers purchasing goods at Walmart during Black Friday.

Image source: Getty Images.

In the first quarter, its revenue grew 9% to $135 billion, its U.S. comps surged 10%, and its adjusted EPS rose 4%. Walmart attributed that robust growth to the COVID-19 crisis, which boosted sales of essential products at both its online and brick-and-mortar stores.

Walmart racked up $900 million in incremental COVID-19 expenses during the quarter, but its stronger revenue growth offset those expenses. Walmart's scale also largely mitigated the impact of tariffs on its Chinese-made goods.

Dollar Tree's revenue rose 3.5% to $23.6 billion last year as its enterprise comps grew 1.8%, with 2.3% growth at Dollar Tree and 1.4% growth at Family Dollar. Unfortunately, its adjusted EPS fell 12% as higher tariffs on Chinese goods overwhelmed its steady sales growth.

That disappointing trend continued in the first quarter: Dollar Tree's total revenue rose 8% to $6.3 billion -- as Family Dollar's 15.5% comps growth offset a 0.9% decline at Dollar Tree -- but its adjusted EPS dipped 4% due to tariffs, markdowns, payroll expenses, COVID-19 expenses, and an unfavorable merchandise mix.

Why Walmart will remain the stronger retail stock

Walmart's scale, its diversification across multiple regions, and its broader catalog of essential products largely insulated it from the macro headwinds as Dollar Tree struggled. The growth of its U.S. e-commerce business, which grew its revenue 74% annually last quarter, further softened the blow.

Dollar Tree's limited selection of essentials and its smaller e-commerce platform caused it to trail Walmart and Amazon in terms of COVID-19 spending, and its overwhelming dependence on products that cost $1 -- many of which are made in China -- increased its exposure to rising tariffs while weighing down its margins.

To top it off, Dollar Tree doesn't pay a dividend, while Walmart pays a decent forward yield of 1.7%. Walmart only spent a third of its free cash flow on that dividend over the past 12 months, and it's raised that payout annually for nearly five decades.

The key takeaways

Dollar Tree isn't a bad investment, but it can't beat Walmart in this tough environment. The dollar store chain is less insulated from macro headwinds, generates slower revenue and earnings growth, and doesn't even reward investors with dividends for riding out the near-term volatility.