With people stuck indoors during the worst of the coronavirus pandemic, Home Depot (HD 0.94%) was a surprise winner. Consumers increasingly took to renovation projects, resulting in major gains for this top brick-and-mortar retailer. The trend has yet to abate. 

In the most recent quarter (ended May 1), Home Depot posted year-over-over revenue growth of 3.8%. This was on top of 32.7% growth in Q1 2021. What's more impressive is that total sales in the quarter of $38.9 billion, which beat analyst projections, were a record for any Q1 in the company's history.  

Does this performance make Home Depot's stock a buy? Let's take a closer look at that important question. 

Person working on a renovation project.

Image source: Getty Images.

Thriving in a difficult environment 

Despite the uncertain economic environment, with soaring inflation, rising interest rates, and the war in Ukraine on investors' minds, Home Depot continues to benefit from strong demand. The robust housing market deserves some credit here, as it provides a solid macro foundation for the business to thrive. 

According to data from real estate brokerage Redfin, U.S. median home prices in April rose 15.4% year over year. Rising housing values encourage people to spend money on renovation projects, as they view the cash outlay as an investment. Furthermore, higher mortgage rates, which raise the cost of purchasing a home, incentivize consumers who may have previously locked in lower rates to turn to upgrades and repairs as opposed to selling their houses and moving. 

Home Depot has also so far seen minimal impact from the inflation that's plaguing the rest of the economy. While transaction counts were down 8.2% compared to the fiscal 2021 first quarter, the average ticket size climbed 11.4%. Big-ticket purchases, those over $1,000, grew 12.4% year over year.  

Investors should appreciate that once again, sales growth from professionals, including contractors, plumbers, electricians, and the like, outpaced DIY customers, signaling consumer propensity to tackle larger, more complex projects that require expert assistance. 

The favorable situation resulted in management, led by new CEO Ted Decker, to raise guidance for fiscal 2022. Home Depot is now expected to increase revenue and same-store sales by 3% for the full year, while growing diluted earnings per share in the mid-single digits. This is in stark contrast to other major retailers, like Walmart and Target, which recently announced weak quarters that crushed their shares. 

Is the stock a buy? 

Home Depot hasn't been immune to the market rout this year. As of May 31, its its stock is down 27% in 2022. Shareholders might be inclined to run for the exits after this poor showing, but this would be a mistake.

That's because Home Depot shares have still produced a total return of 98% over the past five years, beating the S&P 500 during the same time frame. Investors now have the opportunity to scoop up a winning stock that's currently trading at a price-to-earnings ratio of slightly over 19, near the lowest levels over the past decade.  

Not only has Home Depot thrived throughout the worst of the pandemic, but it is now registering growth on top of tough comparisons. This shows the strength of the business and its customer base, no matter what the economic environment is. It also demonstrates that the importance of the home in consumers' lives is a long-lasting trend that investors can get behind and profit from. 

The recent quarter once again proved that Home Depot is a superb business. Therefore, it's probably a smart idea to buy shares right now.