With a market capitalization of $288 billion, Home Depot (HD -1.70%) is easily one of the largest corporations in the world. And as a result, most investors are likely familiar with this omnipresent home improvement retail chain. The company saw demand surge as the pandemic caused people to spend more money on renovation projects.

But these trends have cooled down in recent quarters as macro pressures grow. The shares are down about 10% on the year. So should investors buy, sell, or hold Home Depot stock right now? Continue reading to find the answer. 

Not what investors were hoping for 

During the most recent fiscal quarter (Q1 2023, ended April 30), Home Depot reported diluted earnings per share of $3.82, which beat Wall Street expectations. That's where the good news ends, however. Revenue of $37.3 billion was about $1 billion less than what analysts were expecting. And same-store sales decreased 4.5% from the year-ago period. Management also lowered guidance for fiscal 2023, with the expectation that revenue will be down this year. 

Key trends affecting the business last quarter were unfavorable weather conditions on the West Coast and lumber deflation. However, macro factors are hurting the company. Inflation is pushing consumers to hold off on larger renovation projects. Moreover, consumers are focusing their spending on entertainment and leisure that they might have delayed during the worst of the pandemic. Higher mortgage rates are also leading to a cooling down of the housing market. 

Home Depot is a foundational stock 

While the company's latest financial results disappointed investors, it's hard to argue against Home Depot being a foundational stock for investors' portfolios. And by this, I mean it can be a portfolio holding for many years. There are a few reasons for this way of thinking. 

With trailing 12-month sales of $156 billion, Home Depot is a massive retail business that is a bedrock of the American economy more generally, and the housing market more specifically. And even though it's a huge enterprise already, Home Depot only accounts for a 17% share of what management considers to be a $900 billion total market. This means that the company still has a sizable opportunity to continue taking share in the next decade and beyond. 

Another favorable characteristic that investors should appreciate about Home Depot is its durability. When it comes to foundational stocks, perhaps no other attribute holds more weight than that of staying power. Because it's a brick-and-mortar retailer, Home Depot doesn't attract much technological disruption from industry rivals and upstarts.

Consequently, there aren't a whole lot of venture capitalists looking to upend the home improvement sector. While this can be boring for some investors, it's an outstanding trait to have. It's probably safe to say that Home Depot will be doing the same thing 20 years from now. 

It's also a good idea to be a Home Depot shareholder because of management's friendly capital-allocation strategy. In fiscal 2022, the company paid $7.8 billion in dividends and repurchased $6.7 billion of stock. This is a dream come true for long-term shareholders as it can boost returns. And it's a clear sign that Home Depot generates copious amounts of free cash flow, something that investors can appreciate. 

Looking at the valuation 

With the shares down in 2023, Home Depot's stock trades at a compelling price-to-earnings (P/E) ratio of about 17 today. This is lower than the trailing three-, five-, and 10-year average valuation multiples. And it's cheaper than chief competitor Lowe's, which sells for a P/E of about 20 right now. What's more, Home Depot trades at a discount to the S&P 500's P/E of 18.4. 

This dislocation might not be warranted because Home Depot has averaged a better operating margin and return on invested capital than Lowe's over the past five years. Additionally, Home Depot has posted faster revenue growth during this time. All of this is to say that its valuation probably shouldn't be as cheap as it is relative to Lowe's. Investors with a long-term time horizon should consider buying Home Depot shares.