Home Depot (HD -0.31%) stock is significantly cheaper now than it was in early 2022, with shares down over 25% compared to the 14% decline in the S&P 500 over the same timeframe. The list of investors' worries about the stock grew to include weak customer traffic trends and a potential recession.

Those are short-term concerns, though, and Home Depot has thrived through many such slowdowns in the past. With that track record in mind, let's look at whether the stock for this home improvement retailer is a good buy right now.

Mixed growth results

Home Depot made the best of a bad situation in fiscal 2022. Demand shifted away from the home improvement industry following several years of explosive growth, and costs spiked at the same time. Still, comparable-store sales rose 3% last year on top of an 11% spike in 2021.

But there were signs of stress on the business. Customer traffic fell 5% in the year ending in late January, offset only by a 9% increase in average spending. Home Depot demonstrated pricing power in a tough-demand environment. It was also able to outpace peer Lowe's (LOW -0.14%) thanks to its bigger presence among professional contractors. These factors suggest the industry leader retains a premium position that will be valuable through any potential downturn.

Profits and cash flow

Home Depot's financial strength is just as impressive. It's well understood on Wall Street that the retailer is unusually efficient, with operating profit margin of close to 15% of sales compared to Lowe's 11% rate. The management team excels at capital allocation, too. That's evident in Home Depot's return on invested capital, which routinely lands above 40%.

HD Return on Invested Capital Chart

HD Return on Invested Capital data by YCharts

The company's stock buyback spending helps lift this metric. That spending also amplifies shareholders' returns. Home Depot's earnings per share were up 7.4% in 2022, for example, even though net earnings rose by just 4.1%.

Outlook and value

Investors who buy the stock today will have to exercise patience. Home Depot management projects flat comps in 2023 along with a slight profitability drop. Continued customer traffic declines will be hard to offset even with strong demand among pro contractors.

Yet there's nothing about that weak scenario that threatens the wider investment thesis. Home Depot is steadily winning market share in a massive industry that it already dominates. Shareholder returns are bolstered by stock buybacks, and by a dividend that this past year was hiked by 10% following last year's 15% increase. And attractive growth initiatives include expanding the e-commerce platform and offering more services to pros and do-it-yourself consumers.

Investors might have been overpaying for all that potential back in early 2022 when Home Depot was valued at over 3 times its annual sales. It's harder to make the case that the stock is overvalued today, though, as its P/S ratio sits just below 2 times revenue.

Sure, Home Depot is likely to have a weaker 2023, even if the U.S. economy manages to avoid a recession. But the business should lead the industry out of the next cyclical downturn, just as it has for most of the previous ones. Investors who buy the stock will be happy they simply held the shares in their portfolio until then.