Retailers are feeling more optimistic as we head into the home stretch of 2018. In fact, Home Depot (NYSE:HD) and Target (NYSE:TGT), two of the industry's biggest players, each recently raised their full-year outlooks following a big spike in customer traffic for the second quarter.

Yet while they're both enjoying higher demand and healthy profits today, there are some key differences between these two companies that might make one preferable over the other, depending on your investing goals.

Let's take a closer look by stacking the retailing giants up against each other.

Home Depot vs. Target stock

Metric

Home Depot

Target

Market cap

$231 billion

$46 billion

Sales growth

7%

1%

Net profit margin

9%

4%

Dividend yield

2%

3%

Price-to-earnings ratio

24 times

15 times

52-week stock performance

33%

59%

Sales growth is for the full 2017 fiscal year for stores open at least one year and excludes fuel sales and exchange rate changes. Data source: Company financial filings.

Persistent winner vs. rebound candidate

Home Depot's operating metrics show the benefits of holding a dominant position in an attractive industry niche. The home-improvement market has been growing steadily since bottoming out in 2010, and that tailwind helped the retailer expand annual sales to $100 billion, up from $66 billion seven years ago.

A customer picks out lumber.

Image source: Getty Images.

Sales at existing locations jumped 7% last year, which trounced Target's 1% uptick but also far outpaced the growth of its industry rival, Lowe's (NYSE:LOW). Home Depot's profitability is well ahead of peers both inside and outside of the industry, too. Its operating margin is nearly 15% of sales, compared to 9% for Lowe's and 6% for Target.

Target's core operating and financial metrics pale in direct comparison to Home Depot's, but the retailer still has a few key points in its favor. A recent shift in pricing strategies has contributed to broad market share gains, for one, as sales and traffic growth sped up to their fastest rates in over a decade last quarter. Yes, its profit margins are weak, but there's a good chance that profitability will begin climbing over the coming quarters and years now that sales gains have picked up.

Risks and valuation

Judging simply by the numbers, Target appears to be the safer stock choice. Its valuation of 15 times trailing earnings represents a huge discount to Home Depot's optimistic P/E of 24, after all. The company's retailing focus spans consumer staples like groceries, too, which means it isn't likely to endure the kind of brutal sales and profit slump that Home Depot did during the home-improvement industry's last decline.

Two women shop for shirts.

Image source: Getty Images.

Target's dependability is clear from the fact that it has an unbroken streak of annual dividend raises that stretches all the way back to 1967. Home Depot had to pause its boosts during the Great Recession years, on the other hand. Income investors can also sleep a bit better knowing they're getting an almost 3% yield from this stock, compared to just 2% for Home Depot shares.

That being said, Home Depot should appeal to investors who are willing to pay a premium for high-performing businesses. The retailer dominates in just about every key metric, whether it's sales growth, profitability, or return on invested capital. That level of outperformance is evidence of formidable competitive advantages that, along with smart capital allocation, can deliver impressive returns to investors over the long term even if you have to spend a bit more to buy the stock.

Demitrios Kalogeropoulos owns shares of Home Depot. The Motley Fool has the following options: short February 2019 $185 calls on Home Depot and long January 2020 $110 calls on Home Depot. The Motley Fool recommends Home Depot and Lowe's. The Motley Fool has a disclosure policy.