Home Depot (HD 0.94%) just reported its fiscal 2023's fourth-quarter results, and they were a mixed bag. For the period ended Jan. 28, revenue totaled $34.8 billion, down 2.9% year over year. This missed analysts' expectations by $150 million. While diluted earnings per share of $2.82 also declined, this figure beat estimates.

This top retail stock has soared 18% in the last three months amid a strong market backdrop. But it remains 13% off its peak price. There's an opportunity here for prospective investors to scoop up Home Depot shares and own them for the long haul.

Dealing with macro headwinds

Home Depot posted revenue gains of 19.9% and 14.4%, respectively, in fiscal 2020 and fiscal 2021. The surge in demand can be credited to low interest rates, a robust economic backdrop, and consumers who were flush with cash and ready to tackle larger renovation projects.

But as the macro picture changed, so did Home Depot's prospects. Sales declined 3% last fiscal year. And management expects revenue to rise 1% in fiscal 2024, although executives believe same-store sales will fall 1%.

"After three years of exceptional growth for our business, 2023 was a year of moderation," said CEO Ted Decker. With inflationary pressures on everyone's mind these days, coupled with uncertainty as to the direction of the economy, consumers are now scaling back when it comes to big-ticket purchases like flooring, countertops, and cabinets.

There is a silver lining to the situation, though. Between pre-pandemic fiscal 2019 and 2023, revenue increased by 39%. And it looks like Home Depot isn't giving up any of these gains.

Favorable industry conditions

It's best not to get caught up in the financial results of a single quarter or year because investing is a long-term game. And elite companies are those that can navigate changing circumstances while continuing to penetrate their end markets in a profitable manner. I think Home Depot fits the bill here.

The domestic home improvement industry is massive, with an estimated worth of $950 billion. This means Home Depot, despite its huge size, only commands a 16% market share. There is a ton of room to continue growing in the decades ahead.

But why does Home Depot deserve to keep winning over customers? For starters, no one can compete with its tremendous scale. In this industry, having the right tools, supplies, and products on hand is key, so that customers can get home projects completed on time. Independent hardware stores don't hold a candle to Home Depot in this regard.

Across its more than 2,000 U.S. stores, 90% of the population is within 10 miles of a Home Depot location. Add this to a seamless omnichannel experience, and customers have even more accessibility and convenience. Over the long term, this company is set to continue winning.

Shareholder perspective

In the last five years, Home Depot's operating margin averaged 14.7%, beating smaller rival Lowe's Companies. This consistent profitability has enabled the business to generate lots of free cash flow, which management has used to adopt a shareholder-friendly capital allocation policy that has boosted investor returns.

Home Depot has paid a steadily rising dividend since 1987, and it currently yields a respectable 2.3%. Even better, executives prioritize buying back stock. The outstanding share count has been reduced by 13% since the start of fiscal 2019.

In order to own a business that will continue to benefit from favorable industry conditions, while also returning lots of capital to shareholders, investors are being asked to pay 23.3 times earnings. I view the valuation as being reasonable, especially when you consider that this is a high-quality company you can park in your portfolio for a long time.