After suspending share repurchases at the pandemic's onset, Home Depot (HD 0.94%) has brought them back recently. In the first two quarters of fiscal 2021, Home Depot spent $6.9 billion on share buybacks. 

Importantly, when a company buys its stock, it reduces the number of shares outstanding. The effect that ends up having is profits are split among fewer shares. In other words, each share gets a larger portion. At a market capitalization of $342 billion as of this writing, a $6.9 billion share purchase has a relatively minor impact. Indeed, weighted average shares outstanding decreased by 0.8% from the same six-month period last year.

Still, if Home Depot is spending this much money on buying its stock, does that mean investors should follow and do the same? Let's take a closer look at the company's long-term prospects and determine if that's a good idea. 

Two people looking at lumber.

Image source: Getty Images.

Long-term viability 

Home Depot is one of only a few brick-and-mortar retailers doing a good job of protecting its business from encroachments by Amazon. The nature of the products it sells makes it difficult for Amazon to effectively compete. Nearly half of all sales Home Depot makes are to professionals. Very often, these pro consumers need an item right away to complete a job.

Over the last decade, Home Depot has increased sales by a compounded annual rate of 6.9%. Growth was accelerated during the pandemic but is likely to revert to its long-run trend line. Impressively, Home Depot averaged an operating profit margin of 13.6% during that time; a figure that is growing with the increase in sales.

Moreover, one of the long-term consequences of the pandemic could be the elevated importance of people's homes. While most workers are expected to return to offices sometime later this year or early next, working at home for at least part of the week will be a reality. Whatever that balance between in-office and at-home work ends up settling into, it's likely to be higher than it was before the pandemic. That means an extra space that needs to be maintained and more time spent at home. 

Should you buy Home Depot stock? 

Home Depot's stock price is up over 20% in 2021, despite fears that continued positive developments in battling the COVID-19 pandemic would be a headwind. With billions of people getting vaccinated and economies reopening, Home Depot is likely to experience slower revenue growth at some point sooner rather than later. To add to the potential headwinds, wage costs are rising and the company is facing supply chain challenges.

A chart comparing Home Depot and Lowe's price to earnings ratio.

Data source: YCharts

The stock is trading at a price-to-earnings (P/E) ratio of 23.36, suggesting its fairly valued compared to its historical trading range. Its primary competitor, Lowe's, is trading at a P/E ratio of 21.76 (see chart above). That's a small premium to pay, considering Home Depot operated with a much better profit margin and it had better revenue growth over the last decade.  

While the near-term challenges it is facing do not make Home Depot a screaming bargain, investors are still getting good value with Home Depot. It's not a bad idea to follow management and consider buying Home Depot stock