There were a lot of doubts going into Stanley Black & Decker's (SWK -0.39%) second-quarter earnings report. After all, there are signs of slowing in industrial manufacturing, and its automotive-based sales have already been under pressure in 2019. Throw in a slowdown in house-price growth and the possibility of more commodity, tariff, and currency headwinds to come, and the market had reason to be skeptical that the company could hit its near- and medium-term guidance.

So what happened, and why is the stock looking more attractive now?

Stanley overcomes headwinds

All told, some of the issues outlined above are still concerns; in fact, their impact got worse during the quarter. First, there was an increase in external headwinds for the full year ($50 million more than previously expected, primarily due to an increase in tariffs).

A collection of wrenches, pliers, screwdrivers, and other hand tools

Image source: Getty Images.

Second, Stanley saw some weaker end-market conditions in the second quarter. CEO James Loree noted "some challenges in specific markets this quarter, such as continued declines in global automotive light vehicle production and a deceleration in other industrial-focused end markets." He continued: "Emerging market conditions were also generally weaker than normal in several markets around the world."

However, the company had excellent operational performance, and took full advantage of its self-generated growth opportunities. This led to management affirming its full-year guidance for adjusted earnings per share in the range of $8.50 to $8.70.

What went right

The result demonstrates the success of management's growth initiatives -- more on them in a moment -- and efforts to improve margin. In fact, as Loree noted, this was the first quarter since the fourth quarter of 2017 that operating margin expanded year over year. For reference, the operating margin was 13.8% in the quarter compared to 13.2% in the same period last year, leading to an operating profit of $517 million in the quarter.

Tools and storage (74% of segment profit in the first half) grew organic sales at a 5% rate, thanks to a mix of 3% volume growth and 2% from pricing. Unfortunately, unfavorable currency movements reduced reported growth to just 2%.

These figures show how underlying improvements in the business are being overshadowed by headwinds that probably won't last in the long term. After all, currencies tend to fluctuate, tariffs can't be raised indefinitely, and history suggests that commodity prices are cyclical.

There's little that the company can do about weakness in the industrial segment's (17% of segment profit in the first half) end markets, led by well-documented declines in automotive production and industrial manufacturing. Management lowered its full-year organic growth outlook to a low-single-digit decline, from a previous outlook of "down modestly."

However, the turnaround at security (8% of segment profit in the first half) appears to be working, with operating-margin expansion (15.2% compared to 14.6% in the same quarter last year) helping offset volume declines. For the full year, management now expects organic sales growth and margin expansion, and this could help position the business for potential divestiture.

Why this is good news for Stanley Black & Decker investors

If you can think beyond the near-term headwinds, there's a compelling investment case for the stock, and management's execution in the quarter serves to reinforce it.

The key to the investment thesis lies in a combination of margin expansion through productivity improvements and top-line growth through industry consolidation and expansion into new markets.

Loree believes that by 2020, Stanley can generate $300 million to $500 million in productivity benefits by applying digital technologies to its supply chain -- not bad when you consider operating profit was $1.73 billion in 2018.

Moreover, management has been busy consolidating the tool industry in recent years, buying the Craftsman brand from Sears Holdings for $900 million and the tools business of Newell Brands (Irwin and Lenox plumbing and electrical tools) for $1.95 billion. These purchases enabled Stanley Black & Decker to expand Craftsman product sales outside Sears sales channels, and add complementary Irwin and Lenox tools to Stanley's sales mix. Now the company is aiming to expand organic sales in the mid-single digits, and EPS in the high single digits, on an annual basis over the next three years.

Meanwhile, it expects more effective use of capital to lead to free cash flow generation from net income of 100% by 2022. Furthermore, if management keeps improving margin at the security business, there's always the possibility that could be divested in the future.

The bottom line

Based on the midpoint of guidance, Stanley now trades at a forward price-to-earnings ratio of 16, and the company has just demonstrated that it's on track for this year and beyond. Underlying progress is good. And if and when the headwinds disappear, the company's numbers will start to look a lot better on a headline basis too.

All told, while there are still some hurdles to leap in 2019, Stanley Black & Decker is looking like a good value for long-term investors -- and its recent results reinforce that view.