What happened

Shares of 3M (MMM 0.46%) were moving higher today after the conglomerate topped low expectations in its second-quarter earnings report and put a multibillion-dollar lawsuit behind it. As of 1:09 p.m. ET, the stock was up 4.9%.

So what

3M has been struggling with the slowdown in the economy. Earlier in the year, it implemented layoffs, a restructuring, and other cost-cutting measures to rightsize its business as revenue has declined.

Sales continued to fall in the second quarter. Overall revenue was down 4.3% to $8.32 billion, but that was well ahead of the analyst consensus at $7.87 billion. Organic sales, which exclude the impact of acquisitions, divestitures, and currency exchange, were down 2.2%.

On the bottom line, adjusted earnings per share fell from $2.45 to $2.17, which easily beat estimates at $1.72. Despite the headwinds on the top line, 3M remains highly profitable, with an adjusted operating margin of 19.3%.

The company also took a $10.3 billion pre-tax charge as a result of its settlement with public water services around the country over its production of PFAS, or so-called forever chemicals, which have been found to be environmental hazards. Despite this large price tag, investors seem to be happy that the company is done with this matter.

3M will make $12.5 billion in payments over 13 years as a result of the agreement. 

Now what

Looking ahead, 3M raised its bottom-line guidance for the full year, calling for adjusted earnings per share of $8.60-$9.10, up from its prior range of $8.50-$9, due to its "strong operational execution and cost discipline." It maintained its forecast for adjusted organic sales growth, which excludes revenue from PFAS of negative 3% to flat.

3M is planning to spin off its healthcare unit at the end of the year, which the company believes will help unlock shareholder value, leaving the new 3M to focus on materials science. Healthcare was the only segment that was profitable on an organic basis in the quarter.

While the company is struggling in the current macroeconomic environment, the stock is very reasonably priced at a forward price-to-earnings ratio (P/E) of 12 and a dividend yield close to 6%. If the company can return to top-line growth, the stock looks like a good bet to be a winner, despite its recent struggles.