CNBC's Jim Cramer was immediately intrigued when shares of Masco, a home supply manufacturer, managed to surge more than 7 percent after the company's disappointing earnings report on Tuesday.

Most news headlines painted Masco's quarter as weak, pressured by a slowing housing sector, rising raw costs, a hawkish Federal Reserve, higher tariffs and a muted full-year forecast.

But the action in the stock indicated otherwise, sending Cramer, host of "Mad Money," "a classic signal that the psychology of the market may be changing, and changing for the better."

"Every so often, we'll reach an inflection point, a point where the bad news is totally baked in and a short becomes a long, and that's what happened to Masco yesterday," he said on Wednesday after Masco's stock rose another 1.69 percent. "This is an important tell ... for the broader market, so I want you to understand how it happened and why."

Cramer pointed out that housing pressures, higher interest rates, China and raw cost inflation were already weighing on Masco's stock ahead of its most recent earnings report.

Shares of the Behr parent are still down about 32 percent for the year even though the company has historically had "excellent financial discipline" and strong relationships with retailers like Home Depot, he said.

The quarter, however, wasn't as bad as many feared. Raw costs seemed to peak thanks to lower demand, an "unexpected" benefit that will "bolster Masco's bottom line next year," the "Mad Money" host noted. And even though home sales are slowing, the repair and remodeling business is getting stronger, as is consumer spending.

Lastly, Masco, a global company, has long been navigating changes in raw costs and inflation, so tariffs may not have a drastic effect on business, Cramer said.

On the post-earnings conference call, Masco's management team spoke about shifting production out of China — most of Masco's competitors still source all of their products from China — and managing tariff pressures with a combination of price increases, negotiating with suppliers, supply chain shifts and other efficiency initiatives.

"You've got a stock that's down 32 percent for the year even as its raw costs are now going down, its end markets are holding up thanks to repair and remodeling demand, and its supply chain is strong enough that the tariffs may actually allow the company to crush its private-label competition," Cramer said.

"That's how a stock like Masco manages to rally on seemingly horrific news, and I bet it's got more room to run," he continued. "And that's how you get a bottom in a terrible group."