Much has been made about the current "retail apocalypse." Yet two retailers -- Wal-Mart Stores (WMT 0.46%) and Costco Wholesale (COST -0.24%) -- have continued to thrive even as many of their peers have seen their business models disrupted by e-commerce.

What is it that separates these two retailers from the pack? And which is the better buy today? Read on to find out. 

Competitive advantage  

The core of Costco's competitive strategy is its membership model. The company charges an annual fee ranging from $60 to $120. In return, it offers low prices on a carefully curated selection of goods. Costco often offers limited amounts of many of these products, and the items available change frequently. This low-price strategy and treasure hunt-type experience help to entice people to shop at its stores and also to insulate Costco from the threat of e-commerce.

Wal-Mart is also known for its "everyday low prices." Its massive store network gives it tremendous buying power. Wal-Mart is notorious for leaning on its suppliers for price concessions. It then passes on much of these savings to its customers, which makes them difficult for even online competitors to match.

Moreover, Wal-Mart recognized the threat of e-commerce to its traditional retail operations and made an aggressive move to acquire Jet.com for $3.3 billion in August 2016. It quickly installed Jet CEO Marc Lore as head of its e-commerce division. Since then, Lore has spearheaded numerous initiatives that together have taken what was a struggling part of Wal-Mart's business and transformed it into its most exciting growth driver.

A person holding out a mobile phone with a miniature shopping cart on top of it

Image source: Getty Images.

In all, it's true that Costco's membership model is one of the most effective brick-and-mortar retail strategies in existence. But with more retail sales moving online every day, Wal-Mart's success in this vital area gives it a stronger competitive position going forward.

Advantage: Wal-Mart

Financial fortitude

Let's now take a look at some key metrics to see how Costco and Wal-Mart stack up in regards to financial strength.

Metric

Costco Wholesale

Wal-Mart Stores

Revenue

$129 billion

$490 billion

Net income

$2.7 billion

$12.7 billion

EBITDA

$5.5 billion

$32.2 billion

Operating cash flow

$6.7 billion

$28.0 billion

Free cash flow

$4.2 billion

$17.5 billion

Cash and investments

$5.8 billion

$6.9 billion

Debt

$6.7 billion

$40.2 billion

DATA SOURCE: MORNINGSTAR.

Wal-Mart is the more heavily indebted retailer by far, but its gargantuan cash flows are more than adequate to service its debt while still returning billions of dollars of cash to shareholders. In fact, even after adjusting for its $6.2 billion in dividend payments over the past year, Wal-Mart's free cash flow is still nearly three times that of Costco. For these reasons, I'll give the edge to Wal-Mart for financial fortitude.

Advantage: Wal-Mart

Valuation

No better-buy discussion should take place without a look at valuation. Let's check out some key value metrics for Wal-Mart and Costco, including price-to-sales, price-to-earnings, and price-to-free cash flow ratios.

Metric

Costco Wholesale

Wal-Mart Stores

P/S

0.55

0.55

Trailing P/E

26.49

20.99

Forward P/E

24.88

18.98

P/FCF

16.85

15.04

DATA SOURCE: MORNINGSTAR.

Interestingly, both Costco and Wal-Mart are currently trading at 0.55 times sales. Yet Wal-Mart is the more profitable business, with operating and net margins of 4.6% and 2.6%, respectively, compared to 3.2% and 2.1% for Costco. In turn, Wal-Mart sports lower trailing and forward price-to-earnings ratios, and it's also cheaper on a price-to-free cash flow basis. That makes Wal-Mart's stock the better deal.

Advantage: Wal-Mart

The better buy is...

With Wal-Mart Stores coming out ahead in all three categories -- competitive advantage, financial strength, and stock valuation -- it's clearly the better buy today.