Last year was not easy for investors, but things seem to be improving. As of this writing, the S&P 500 is up 21% from its 52-week low in October 2022. With the broader index firmly in bull market territory, investors might want to look at some companies that haven't participated in the market's rally. 

Home Depot's (HD 0.94%) shares were up just 5% through the first eight months this year, but it's a wonderful business that deserves some attention from investors. This is despite its latest financial update that showed declining sales and earnings. 

Here are three compelling reasons to buy this top retail stock. 

1. Positive industry tailwinds 

In the latest quarter (Q2 2023, ended July 30), Home Depot reported revenue of $42.9 billion, which represented a year-over-year decline of 2%. Diluted earnings per share were also down from Q2 2022. After experiencing tremendous growth during the pandemic, Home Depot is dealing with a notable slowdown. 

But this doesn't take away from the company's long-term prospects, driven by a favorable industry backdrop. The average age of a house in the U.S. is 39 years old, so there should be healthy demand for the tools, parts, and supplies that this leading home-improvement retailer sells. Moreover, the ongoing work-from-home trend in the U.S. can be a net benefit for Home Depot.  

Even though Home Depot is a huge enterprise, with trailing-12-month revenue of $155 billion, it only commands about 17% of the overall industry. The market is highly fragmented, so the company's vast reach, omnichannel capabilities, and wide product assortment can help increase market share over time. 

2. Leading position with Pros 

Home Depot caters to do-it-yourself (DIY) customers, like the average consumer, and professionals, like contractors, plumbers, and electricians. Each group represents about half of the total company sales. But the pros are really the key to Home Depot's success. 

Professionals, who make up about 10% of the company's customer base, tend to spend much more than DIYers, while also visiting stores more frequently. This isn't surprising, given that pros are likely working on multiple projects at once and need a wide range of products at any time. This makes Home Depot a mission-critical partner, a standing bolstered by the fact that 90% of the U.S. population lives within 10 miles of a store. 

Smaller rival Lowe's (LOW -0.04%) only gets about 25% of its revenue from professionals, giving Home Depot a huge advantage with an extremely valuable and lucrative customer segment. From a financial perspective, the benefits are clear. Home Depot consistently posts greater sales per square foot and return on invested capital than Lowe's, particularly as it's able to drive higher revenue per location, thanks to business from pros. 

3. Favorable setup for shareholders 

Home Depot stock's 60% gain in the past five years exceeds that of the S&P 500. But despite this outperformance, shares are attractively priced. They currently trade at a price-to-earnings (P/E) ratio of 20.6.

Not only is that valuation cheaper than the stock's trailing three-, five-, and 10-year average P/E multiples, but it's also a discount to Lowe's current selling price. This setup provides an advantageous entry point for prospective investors. 

The business also pays a healthy dividend that currently yields 2.5%. The quarterly payout, which started back in 1987, has consistently increased over the years. Additionally, Home Depot has used its free cash flow to buy back shares.

In the last 10 years, the outstanding share count has been reduced by 30%. Management has just authorized another $15 billion in repurchase capacity, so investors can benefit from favorable capital allocation policies.