Home Depot (HD -0.31%) shareholders have some new reasons to celebrate. The home improvement retailer announced fresh operating numbers this week that included record sales even compared to soaring year-ago figures.

But digging into the results shows some weaknesses in consumer spending that might make for a difficult second half to fiscal 2021.

Let's take a look.

A man and woman painting a room.

Image source: Getty Images.

Customer traffic is down

Home Depot's executives highlighted the fact that growth was strong even compared to last year when sales spiked over 20% due to pandemic-related demand surges. Comparable-store sales rose 3% in the core U.S. market in the second quarter, pushing the chain to over $40 billion in quarterly sales for the first time ever. "I am very proud of our associates, who continue to demonstrate a relentless focus on serving our customers," CEO Craig Menear said.

But customer traffic was down, falling 6% compared to the nearly 20% boost Home Depot had seen in recent months. The chain offset that decline with higher spending per visit, which is a big win that likely reflects its success in the professional contractor niche. Still, it will be harder for sales to keep climbing if traffic losses don't slow.

Profit margins jumped

Investors were bracing for potentially weaker profit numbers, given spiking costs on everything from labor to transportation. But this report showed no sign of that stress.

Operating profit jumped 9% to $6.6 billion, which pushed operating margin up to 16% of sales from 14% last quarter. Sure, some of that increase can be tied to unusual price volatility, especially for lumber.

But Home Depot seems to have had no trouble passing along higher prices to consumers while satisfying their demand for more premium products and installation services.

HD Operating Margin (TTM) Chart

HD operating margin (TTM) data by YCharts. TTM = trailing 12 months.

There will be noise in this metric for at least the next few quarters, but investors might still reasonably hope to see operating margin climb higher than the 14% to 15% rate that the chain had seen before the pandemic struck.

Cash returns are surging

The growth outlook is cloudy, with major risks including a housing pullback or accelerating slumps in customer traffic due to COVID-19 outbreaks. But investors can still count on robust direct cash returns as they wait for Home Depot's operating trends to stabilize.

Executives have spent $6.9 billion on stock buybacks so far in 2021, and $3.5 billion in dividend payments. That translates to a bit more than 100% of operating earnings over the last six months, which is a testament to management's prioritizing shareholder returns.

This steadily rising flow should protect investors' returns through the next few choppy quarters even if customer traffic trends don't quickly rebound. If the stock drops much due to this report, meanwhile, investors might consider buying this high-performing retailer.

While the next six months of growth could look weak compared to a year earlier, all the ingredients are still here to support great long-term returns. These include market share gains in a growing industry, leading profit margins, and rising dividend payments, just to name a few.