The stock market is arguably the best tool people have to build long-term wealth. While the S&P 500 has averaged annual returns of roughly 10% over time, there are some individual stocks that have fared much better. 

Home Depot (HD -0.03%), the world's leading home-improvement chain, is a company that's produced astronomical returns for shareholders over the years. A $1,000 investment made when the stock started trading publicly in 1981 would be worth a remarkable $16 million today. This translates to a 27% annual return, crushing the broader market. 

Let's find out how this happened. 

Father and daughter working on a home improvement project.

Image Source: Getty Images

This is a top-notch retailer 

You may be surprised that a retail stock produced this kind of return. Home Depot's expansion depended less on opening more stores and more on significantly boosting the volume of each location. 

Ten years ago, the business operated 2,245 stores. Today, that number has only grown by 53, and now totals 2,298 stores. Yet sales have soared from $16.8 billion in Q1 2011 to $37.5 billion in Q1 2021. And during the same time, net income jumped more than fivefold, demonstrating the outstanding operational efficiency with which Home Depot is run. 

The company serves both do-it-yourself (DIY) and professional (Pro) customers, making it a mission-critical partner when renovation projects need to get done. This was never more apparent than during the pandemic, when DIYers who were stuck at home increased their focus on home-improvement spending. 

Now, with the world slowly opening up, Pro backlogs are on the rise as people feel comfortable letting contractors inside. These Pros need tools and supplies from Home Depot urgently, and the business has successfully delivered. 

The reason Home Depot is able to do this, while at the same time defending itself from the likes of e-commerce behemoth Amazon, is because of its superb supply-chain proficiency. Dubbed the One Home Depot initiative, the business made it a priority years ago to bolster its omnichannel capabilities and provide a better, one-stop-shopping customer experience. 

This extreme focus on the consumer is a main reason why the stock has done so well. 

The future looks bright 

Home Depot's pandemic-fueled momentum hasn't abated. The most recent quarter saw same-store sales increase 30% in the U.S., with 100% growth in digital sales, when compared to the same period in 2019. This is now a $352 billion company, so don't expect the massive returns of the past to repeat in the future. 

But there are some things to be optimistic about. Home Depot is benefiting from a hot housing market, characterized by tight supply and still historically low interest rates. As people are inclined to buy new homes, it spurs demand for Home Depot's products. Additionally, the growth of remote-work arrangements will cause many to reassess their living situations, again supporting Home Depot's business. 

Even in adverse economic times, Home Depot does well. Instead of buying a new place and moving, people will focus their attention and money on fixing up their current living quarters. This is a recession-proof company, so it's no wonder the stock has been a huge winner. 

As it stands today, Home Depot's stock trades at a price-to-earnings (P/E) ratio of 24. Compared to the S&P 500's P/E of 31, this looks like a major bargain for a perennial high-quality business.

Don't expect future returns to resemble the past, but scooping up shares of Home Depot seems like a smart move. A $1,000 investment today could be worth a lot more many years from now.