Wal-Mart (NYSE:WMT) and Lowe's (NYSE:LOW) each have a nagging growth problem. For Wal-Mart, its customer traffic trends consistently trail rival Costco's (NASDAQ:COST). Lowe's, meanwhile, can't seem to break Home Depot's (NYSE:HD) tight grip on the home improvement market.

However, investors shouldn't ignore retailers simply because they are outshined in some areas by rivals. In fact, these out-of-favor stocks tend to be available at attractive valuations that leave plenty of room for market-beating gains. With that in mind, let's look at these two companies as potential buy candidates.

Here are a few key statistics to get us started:

Metric

Wal-Mart

Lowe's

Market cap

$212 billion

$62 billion

Sales growth

1.4%

3.9%

Net profit margin

3%

3.9%

Dividend yield

2.9%

2%

Return on invested capital

15%

13.6%

Price-to-sales ratio

0.45

1

Price-to-earnings ratio

15

26 

52-week price performance

13%

(5%)

Data sources: Company financial filings and S&P Global Market IntelligenceSales growth and return on invested capital are for the past nine months and exclude fuel sales and exchange rate changes. 

Growth slowdown

Wal-Mart's biggest achievement over the past few years has been a steady rebound in its customer traffic trends. Shopper transactions ticked higher for the eighth consecutive time last quarter, and while its 0.7% increase trailed Costco's 2.4% jump, Wal-Mart clearly has momentum on its side. Improved average spending per visit and e-commerce sales both contributed to a near-3% revenue boost in its U.S. stores last quarter, which equates to $2 billion of extra revenue.

Home Improvement Shopper

Image source: Getty Images.

Lowe's is enjoying faster growth, but only because its industry is in a sharp upswing. Comparable-store sales are up 3.9% through the first three quarters of 2016. Home Depot enjoyed nearly twice that growth pace, which is one reason why Lowe's management isn't happy with its recent performance. "Traffic slowed more than we anticipated in August and September before improving in October," CEO Robert Niblock told investors.

Unlike Home Depot and Wal-Mart, Lowe's is getting help from a growing store footprint that pushes sales higher. Yet its latest results suggest it is losing more ground to rivals while Wal-Mart is winning back some share.

Profits heading lower

Wal-Mart's 3% profit margin makes it significantly more profitable than Costco. However, its earnings power is under considerable pressure that could stick around for years. Over the short term, profits have plunged as the retailer plowed cash into initiatives aimed at improving the customer shopping experience through higher employee wages and better stocked shelves. Rising shopper satisfaction scores and increased customer visits are the key benefits of those moves, but they came at a significant cost. Operating income fell 11% over the last full fiscal year.

Lowe's isn't faring any better. In fact, its profitability has slumped as the retailer increasingly turns to price cuts to protect its sales growth. Its 3.9% net margin is less than half of Home Depot's.

LOW Profit Margin (TTM) Chart

LOW Profit Margin (TTM) data by YCharts.

The better buy

Investors can buy Lowe's at about 1 times sales, or well below Home Depot's ratio of 1.8. Similarly, Wal-Mart is available at 0.45 times the past year of revenue, compared to 0.59 times sales for Costco.

While both valuations represent significant discounts, I'm more optimistic about a Wal-Mart purchase today. The retailing titan appears to have a good plan in place for protecting market share from traditional rivals and from e-commerce threats. Lowe's, on the other hand, has only seen its market share losses accelerate on challenges from a competitor that seems to have a much better read on its industry.

Neither company is likely to wow shareholders with market-thumping operating results anytime soon. But Wal-Mart's sturdier traffic and profitability trends make it the better buy in this match up, in my view.

Demitrios Kalogeropoulos owns shares of Costco Wholesale and Home Depot. The Motley Fool owns shares of and recommends Costco Wholesale. The Motley Fool recommends Home Depot. The Motley Fool has a disclosure policy.