Is Home Depot Inc. a Buy?

Home Depot's (NYSE: HD) double-digit stock price rise has made it one of the biggest gainers on the Dow so far this year. Investors love that this home improvement leader continues to post solid growth even as consumers shift more and more of their shopping online.

Let's look at why Home Depot's stock still might be a buy even as it sits near all-time highs.

Operating results

Home Depot isn't immune to the negative trends that have been hurting most physical retailers. In fact, customer traffic growth is down significantly. Last quarter the company logged less than 2% higher traffic, compared to last year's 3% boost. It enjoyed 5% traffic gains as recently as 2015.

Home Depot is making up for that slowdown through higher average spending, though. Thanks to steady market share gains in the professional side of the business, spending jumped almost 4% higher last quarter. As a result, overall comparable-store sales gains were a whopping 6%. That was three times the growth pace that rival Lowe's (NYSE: LOW) managed.

Home Depot also trounced its smaller peer in profitability. Its operating margin is nearly 14% of sales, compared to less than 10% for Lowe's.

There isn't even much daylight between the two businesses in terms of sales growth opportunities. Sure, Lowe's is aggressively adding to its store base, with plans to tack on an additional 35 warehouses this year. In contrast, Home Depot has held its U.S. footprint steady over the past five years. But Home Depot is pushing into new market niches, including the pro contractor segment and the maintenance, repair, and operations industry. That's a key reason why its revenue should grow at about the same pace as Lowe's in 2017 even as it prepares to cross $100 billion in annual sales.

The online challenge

Market-thumping operating results likely won't be enough to protect shareholders from losses over the long term if CEO Craig Menear and his executive team fail to meet the threat posed by e-commerce giants. So far, they've proven up to this massive challenge.

Home Depot has one of the biggest e-commerce retailing operations in the market, and its digital business is well plugged into the physical shopping experience, given that almost half of e-commerce orders involve the buyer making a trip to their local Home Depot store. Digital sales are worth 6% of the business today, not far below the 7% figure for the retailing industry as a whole.

Management understands that it can't stand still in this area, and so the company recently rolled out a national buy-online-ship-from-store functionality to complement its impressive online fulfillment capabilities. The risk is that investments like these fail to keep customers inside Home Depot's ecosystem or force lower profits in exchange for the business.

Is it a good value?

There's no sign of that happening yet, and so Home Depot's path to achieving a 15% operating margin by 2018 (at around the time it passes $100 billion of sales) seems clear. That optimism comes at an expensive price.

Home Depot is valued at a hefty premium over Lowe's; its price-to-sales ratio is almost twice its competitor's, and you'd have to pay 21 times expected earnings for Home Depot today, compared to 17 times for Lowe's.

Market leaders, particularly those that have demonstrated unusual skill at capital allocation, tend to earn their premium valuations, though. In my view, that's what Home Depot will continue to do for investors who aim to hold this stock for the long-term.

10 stocks we like better than Home DepotWhen investing geniuses David and Tom Gardner have a stock tip, it can pay to listen. After all, the newsletter they have run for over a decade, Motley Fool Stock Advisor, has tripled the market.*

David and Tom just revealed what they believe are the 10 best stocks for investors to buy right now... and Home Depot wasn't one of them! That's right -- they think these 10 stocks are even better buys.

Click here to learn about these picks!

*Stock Advisor returns as of June 5, 2017

Demitrios Kalogeropoulos owns shares of Home Depot. The Motley Fool recommends Home Depot and Lowe's. The Motley Fool has a disclosure policy.