As two of the country's biggest retailers, Costco (NASDAQ:COST) and Target (NYSE:TGT) both represent bets on consumer spending. But that's about where the similarities end between these two investments. In fact, the stocks boast such opposite trends that they appear to be operating in different markets. There's also a huge valuation gap between them that could make Target the relative bargain.

More on that pricing difference in a moment. First, let's compare these retailers' key investment statistics.

Costco vs. Target stock

Metric 

Costco 

Target 

Market cap

$71 billion

$29 billion

Sales growth

4%

(1%)

Net profit margin

2%

3.9%

Dividend yield

1.2%

4.7%

Price-to-sales ratio

0.57

0.43

Price-to-earnings ratio

28

11

52-week stock performance

3%

(25%)

Sales growth is for stores open at least one year and excludes fuel sales and exchange rate changes. Data source: Company financial filings and S&P Global Market Intelligence.

Operating matchup

Costco and Target both sell clothing, electronics, groceries, and housing supplies to a huge shopper base, and yet Costco's business is growing at a much healthier clip today. The warehouse giant's comparable-store sales rose 5% last quarter thanks to a balanced mix of higher customer traffic and increased spending per visit. Target, meanwhile, posted a 1% drop in comps as traffic and average spending both fell. Gross profit margin also declined at the retailing chain as it boosted investments in the online sales channel.

A Target employee helps a customer.

Image source: Target.

Target is losing market share to rivals, both online and in physical locations, which calls into question its long-term growth outlook. Management as recently as last year had been optimistic that Target's signature product categories like apparel, health and beauty, and home furnishings would protect the company from price-based competition. But a long string of comp declines convinced them that a dramatic shift in strategy would be needed instead. That's why in February Target announced a shift to a new, price-based competitive posture. This move will trade short-term pain for long-term gain, CEO Brian Cornell explained at the time. "We are confident that these changes will best-position Target for continued success," Cornell said.

Costco's operations are seeing broad improvements. Customer traffic is rising, comps are accelerating, and membership renewal rates rose recently following a rare decline last year. Sure, the warehouse giant's bottom-line profitability is half Target's figure. But those earnings are much steadier because they come primarily from annual membership fees.

It's worth keeping in mind that Costco is taking a more conservative approach to the threat from e-commerce. Management believes its membership club focus limits their need to aggressively set up shop online. Robust traffic growth lately seems to support that reading, but if Costco is wrong here, it could set shareholders up for pain down the road.

Which is the better buy?

Both stocks are trailing the market over the past year, but Target's 25% slump has made it far cheaper on both a price-to-sales and price-to-earnings basis. Its dividend yield is roughly four times Costco's 1.2%, too, although Costco in practice pays out much more than its promised annual yield implies.

Income investors might prefer the steady, market-thumping payout that Target offers, especially given this Dividend Aristocrat's stellar track record of 46 years of consecutive annual raises. In any case, it's the more defensive purchase, considering all the pessimism already reflected in the stock price.

Investors looking for a more certain sales and profit growth outlook should buy Costco instead. Yes, they'll pay a handsome premium for that brighter operating forecast. But Costco has consistently earned its high valuation and appears set to continue that streak even as online shopping disrupts the retailing industry.

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