The stock market has been hitting new heights in recent days, contrary to some of the gloom and doom predictions of just a few months ago. But every rally must end. The key is to have a system in place that will guarantee your profits just as much in bear as in bull markets.

Consumer spending has been one of the brighter spots in the latest round of economic data. 3M (MMM) - Get Report sells some of the most iconic brand name products in the American economy: Scotch tape, Post-It Notes, Scotchgard and many others. It has recovered from a dip late last month and is a solid buy for investors. Shares fell slightly in Friday trading. 

Image placeholder title

In addition, 3M just marked its 100th consecutive year of dividends of issuing dividends to shareholders. A hallmark of the company's success is the ability to consistently invest to grow the core businesses and to create value for shareholders, including paying a strong, steady dividend.

In its most recent earnings report, the Minnesota-based company reported record earnings per share for the quarter. Earnings came in at $1.29 billion, or $2.08 per share, slightly higher than what most analysts expected.

Four of the firm's five business groups posted margins above 23%, including healthcare at 33%, and safety and graphics at 27%, demonstrating the diversification of the company's strengths.

3M is constantly reinventing its products to keep up with the changing marketplace and also with new regulatory requirements. Its highest sales growth in April, May and June came from its health care unit, which grew 4.9%. Consumer business revenue grew 2.7%.

The only disappointment was the company's electronics division, which has seen weaker demand than expected, CEO Inge Thulin told analysts during a conference call. "We'll [be] waiting until sometime in 2017 to see a change in consumer electronics."

But although most of the company's businesses are chugging along, and the one laggard has excellent prospects for a turnaround, the stock price fell about 2% on the news. It has since recovered some of that ground, but it is still a buying opportunity for savvy investors who know a long-term winner when they see one. The price-earnings ratio of 23 is reasonable considering how solid and reliable the company's profit margins are.

3M looks even better compared to some of its industry competitors. In its last report, Caterpillar reported that its second-quarter revenue fell 16%. General Electric has seen its profit margins narrow due to lower revenue from its oil division.

As with many quality long-term investments, diversification is the key. Industrial sales may be cyclical, but the firm's health and consumer divisions can take up the slack.

---

While everyone's happy about the bullish performance of the stock market in recent weeks, an unpredictable event - a terrorist attack, a sudden surge in the price of oil, anything - could turn things around in a heartbeat. You must have a system in place that will guide your portfolio into positive territory in foul weather as well as fair. We've got a system that can guarantee you will profit from 85% of your trades! To get the report, just click here!

This article is commentary by an independent contributor. At the time of publication, the author held no positions in the stocks mentioned.