Over the past 10 years, Home Depot (HD 0.94%) has been a wonderful investment. Shareholders have seen the stock rise nearly 300% since October 2013, a gain that significantly outpaced the broader S&P 500. 

This top retailer's returns over the long term are certainly impressive. While there are many factors that contributed to this performance, most notably strong revenue and earnings growth, I think there's one key detail that can be singled out as a main driver of Home Depot's success. 

Here's what investors need to know. 

Catering to a specific customer 

Of the $155 billion in trailing-12-month revenue that Home Depot generated, about half of it came from professional customers. This group includes contractors, plumbers, electricians, and the like who do housing upgrades and renovations as an occupation. The other main customer cohort are DIYers that tackle these projects on their own without the help of a professional. 

The leadership team has stated that professionals only make up about 10% of the overall customer count. Some basic math tells us that pros spend on average 9 times the amount that a typical DIY customer does. This means that they not only spend a lot more, but they also surely visit stores more frequently as well. 

Why is this so important? Well, having higher-value customers has resulted in better metrics for Home Depot, particularly when compared to its key rival, Lowe's. Home Depot's sales per square foot ($685) and return on invested capital (41.5%) crush its smaller competitor. And in the past five fiscal years, Home Depot's operating margin has averaged 14.7%, much better than the 9 6% reported by Lowe's. 

Home Depot commands less than 17% of the massive $950 billion home improvement market here in the U.S. But this share makes it the biggest business in the industry. That tremendous scale means that Home Depot has the financial resources to always have the right product assortment at its stores, while ensuring that it's also investing in its omnichannel capabilities. For professionals that are on tight schedules and need the right tools and supplies to get their jobs done, it's almost a no-brainer to shop at Home Depot.  

Unsurprisingly, Home Depot executives are focused on keeping pros a strategic priority. Key offerings that are currently available are volume discounts, tool rentals, a rewards program, and a dedicated customer service line. And in 2021, Home Depot launched a Path to Pro program to provide skills training and networking opportunities to those in the industry. This commitment can lay the foundation to drive even more sales from professionals over time. 

Is Home Depot stock a smart buy? 

While this stock has been a winner over the very long term, investors who are on the sidelines might be looking at the business now as a potential buying opportunity. It could be a good time, as shares are 31% below their peak price. Moreover, they trade at a price-to-earnings ratio of 17.8, which is much lower than their trailing-10-year average. 

The valuation has probably been pressured due to macro impacts. Home Depot's sales have taken a hit as consumers cut back on big-ticket purchases. And higher mortgage rates have led to less activity in the housing market. 

But again, Home Depot's scale is a huge advantage compared to independent hardware stores. And this will help the retailer continue stealing share in what is a large market. 

And speaking more to the overall home improvement industry, management is optimistic about its prospects despite near-term headwinds. The housing inventory shortage, coupled with the high average age of homes in the U.S., creates durable demand for what Home Depot sells. 

Perhaps it's as good a time as ever to take advantage of the opportunity the stock market is offering right now and buy shares in Home Depot, with the aim of holding for the long term.