The Dow Jones Industrial Average fared better than the S&P 500 in 2022. Yet the more focused index was still down 10% through late December. A few blue-chip Dow stocks outperformed that result, but many posted double-digit declines this year.

The good news is that the pessimism has created some attractive buying opportunities for investors seeking bargains. With that in mind, let's take a closer look at one stock, Home Depot (HD 0.94%), which has declined by 24% but still looks like a great long-term addition to your portfolio.

The risk ahead

There's no denying that Home Depot is entering a potentially difficult period for the business. The housing market is slowing rapidly as mortgage financing costs soar. The home improvement niche might be under intense pressure in 2023 even if the Federal Reserve succeeds in bringing down inflation without tipping the economy into a recession. That risk helps explain why this cyclical stock is down this year.

Yet Home Depot has thrived through many industry downturns in the past. It is also entering this next volatile period from a position of strength. Sales are on track to rise 3% for all of 2022 on top of double-digit gains last year.

Home Depot is also expecting a blistering 15.4% operating profit margin despite the pressures of slowing sales and soaring costs. That success makes it stand out against peers like Lowe's Companies, with its 12% profit margin.

How things might work out

Investors shouldn't ignore the likelihood that the housing market avoids a painful recession in 2023. It's possible that sales for home improvement giants like Home Depot grow slowly, just like they did in 2022. That possibility should be balanced against the fact that customer traffic trends are weak, though.

Home Depot had 5% fewer visits in the first nine months of 2022 compared to the prior year, and overall growth came entirely from higher average spending.

Still, the company remains a leader in the industry in key metrics like organic sales growth and profitability. Home Depot's business is more diverse than Lowe's thanks to its larger sales footprint and its bigger presence in the professional contractor niche. Those assets should support solid returns through a wide range of selling conditions in 2023.

The stock is cheap

If you're worried about buying Home Depot right before a cyclical downturn, keep in mind that you're getting a solid discount for that added risk. Shares today are trading for 2.1 times annual earnings, translating into a 27% lower valuation compared to late 2021.

HD PS Ratio Chart

HD PS Ratio data by YCharts

That valuation slump only makes sense if you are focused entirely on the short term, or if you believe Home Depot will be a fundamentally weaker business in an era of higher interest rates.

The company's stellar track record, including its ability to rebound from the housing market crisis in 2009, suggests that this bearish reading is wrong. Home Depot is a world-class retailer with excellent financial strength. Those assets should serve investors well as they hold through what could be a rocky period in 2023.