You might not think of CVS Health Corporation (NYSE:CVS) and Wal-Mart (NYSE:WMT) as rivals, but they are. CVS Health makes nearly one-quarter of total net revenue for its retail/long-term care (LTC) segment from front-store sales, which include the same types of items you'd find at Wal-Mart. And Wal-Mart ranks as the fourth-largest pharmacy retailer in terms of total prescription revenue. The bottom line is that the two companies compete for the same customers.

Wal-Mart is certainly much bigger than CVS Health, though. Its stock has also been the better performer so far in 2017, soaring more than 30% while CVS Health's share price has fallen. But which stock is the better buy now? Here's how CVS Health and Wal-Mart stack up against each other.

Woman facing arrows pointing left and right

Image source: Getty Images.

Growth

Over the last five years, CVS Health has grown its revenue by nearly 50%. During the same period, Wal-Mart's revenue growth has been stagnant. CVS Health's bottom line has also looked much better, with trailing-12-month earnings growth of 30% over the last five years compared to a 25% decline for Wal-Mart. 

Investors are better off looking to the future rather than the past, however. CVS Health lost a couple of major contracts to rival Walgreens Boots Alliance last year. As a result, the company's growth has tapered off significantly in 2017. Wal-Mart, meanwhile, appears to be executing well on its turnaround strategy and should return to earnings growth in its next fiscal year.

Still, Wall Street analysts project that CVS Health will be able to grow earnings a little more than Wal-Mart will over the next five years. And that's not factoring in the possibility that CVS Health will acquire Aetna as has been reported recently. Overall, CVS Health appears to have the advantage over Wal-Mart when it comes to growth.

Dividend

Both companies pay out attractive dividends. CVS Health's dividend currently yields 2.9%, while Wal-Mart's dividend yield stands at 2.31%. 

But could Wal-Mart overtake CVS Health with future dividend hikes? Maybe, but I wouldn't count on it. CVS Health has increased its dividend payments by more than 120% over the last five years, while Wal-Mart has grown its dividend by less than 10% during the period. 

Wal-Mart uses less than half of its earnings to fund the dividend program, so it could potentially pour more money into bumping up its dividend. However, CVS Health is in even better shape to do so, with a payout ratio of only 37%. CVS Health is the clear winner in the dividend department.

Valuation

Some investors like to use the price-to-sales ratio to compare stock valuations. Others prefer the price-to-earnings ratio. Some people like the enterprise value-to-EBITDA metric (EV/EBITDA). Let's look at how CVS Health and Wal-Mart compare on all three counts.

CVS Health edges Wal-Mart on valuation based on the P/S ratio, with shares trading at 0.4 times sales versus Wal-Mart's 0.55 times sales. There's an even bigger advantage using the P/E ratio. CVS Health's trailing-12-month earnings multiple is 14, while Wal-Mart stock trades at nearly 22 times trailing-12-month earnings. Even if we look to the future, CVS Health has an advantage. The stock trades at 11 times expected earnings, compared to Wal-Mart's forward earnings multiple of nearly 20. 

That leaves EV/EBITDA. CVS Health wins again, with an EV/EBITDA ratio of 8.36. Wal-Mart's EV/EBITDA is 9.27. No matter how you look at it, CVS Health stock appears to be more attractively valued.

Better buy

This doesn't look like a very difficult decision. CVS Health has better recent growth than Wal-Mart in both sales and earnings. It probably will enjoy slightly higher earnings growth than Wal-Mart over the next few years. It pays the better dividend. And its stock valuation seems more attractive.

But what about Amazon.com (NASDAQ:AMZN)? CVS Health and its peers have seen their stock prices drop as investors fretted about the possibility that the internet retail giant could enter the pharmacy business. I don't think that changes the dynamic enough to give Wal-Mart an advantage over CVS Health, though. After all, Wal-Mart has its own battles to fight with Amazon.

CVS Health is the better pick right now over Wal-Mart. Because of its lingering challenges combined with the emerging threat from Amazon, however, I think there are even better stocks to buy.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Keith Speights has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon. The Motley Fool recommends CVS Health. The Motley Fool has a disclosure policy.