Home Depot (HD 0.80%) needs little introduction. The nation's No. 1 home improvement retailer is one of the most valuable retailers in the world, with a market cap of $322 billion.

It's also one of the best-performing stocks in history. The company went public in 1981, when it was still a young company, and since then, its share price has increased by nearly 1,600,000%. In other words, it's turned $1,000 into close to $16 million, and that doesn't include dividends reinvested.

However, more recently, Home Depot has struggled. The home improvement retailer has felt the impact of a sluggish housing market and weaker demand for home improvement projects because of inflation and high interest rates. In 2022, the stock fell back from its pandemic peak and has yet to recoup those gains. As a result, the stock is down 22% from its all-time high at the end of 2021.

That makes sense given the company's recent performance, as revenue fell 2.3% to $36.4 billion, and comparable sales slipped 2.8% in its first quarter.

However, those headwinds won't last forever. Let's look at why Home Depot is a buy now.

A Home Depot employee organizing an aisle.

Image source: Home Depot.

Home Depot's path to recovery

While Home Depot's revenue and profits might be down, investors shouldn't confuse that with any structural or competitive weakness in the business as the slowdown is the result of a downturn in the housing market.

Existing home sales are hovering around 30-year lows, but that should change once interest rates and mortgage rates start to come down. The Federal Reserve has predicted that this could happen as soon as later this year.

The company's guidance also calls for a modest improvement over the remainder of the year, as it sees comparable sales falling 1% for the year, implying roughly flat growth in the remaining three quarters.

Its guidance doesn't include the acquisition of SRS Distribution, the building materials company it bought for $18 billion earlier this year.

That move shows that Home Depot is focused on expanding its addressable market beyond its conventional retail business focused on professional and DIY customers.

The SRS acquisition will expand the company's addressable market by $50 billion and give it upstream positioning with its Pro customers, increasing revenue and strengthening its customer relationships.

The acquisition also reflects Home Depot's financial strength. The company generates strong margins and returns most of its profits to investors through dividends and share buybacks.

Why Home Depot stock is a buy

Home Depot's competitive advantages are clear. The company operates in a duopoly with Lowe's in a massive addressable market that's worth approximately $1 trillion of annual revenues.

The industry has high barriers to entry as Home Depot and Lowe's carry thousands of specialized SKUs and have complex supply chains that make it hard for even a company like Amazon to compete with them.

In addition, the surge in home prices in recent years should favor spending at Home Depot over the longer run, as spending on home improvement projects is correlated with home values. Once mortgage rates fall, homeowners should be more likely to tap into their home equity.

There's also an estimated shortage of 4 million homes in the country, which should provide a tailwind to Home Depot as that gap should eventually close. The SRS Distribution acquisition should help it address that market to serve homebuilders and contractors that source materials more directly.

Home Depot stock might not look cheap at a price-to-earnings ratio of 22, but investors should remember that its earnings are temporarily suppressed right now by the weak housing market.

Once housing demand normalizes, Home Depot's earnings could soar. In the meantime, investors can get paid to wait by the company's 2.8% dividend yield.