The semiconductor sector is turning the corner and showing signs that the global economy could be stronger than previously thought, CNBC's Jim Cramer said Tuesday.

The industry's attempt to bounce back from its 2018 woes is being propped by Nvidia's roughly $6.8 billion cash bid for Israeli chipmaker Mellanox and Bank of America's upgrade of Apple, which could mean that the inventory glut in chips could be gone, he said.

"These days the semiconductor companies have their tentacles in everything," the "Mad Money" host said. "Now, I often tell you that housing punches above its weight when we talk about the economy. If housing's strong, then the strength might spread to banks and retail. These days, in the new global economy dominated by data, the semiconductor stocks punch well above their weight, just like housing."

Semiconductors, he noted, once led the market until last spring the segment began running into troubles. That included Skyworks' exposure to China as the trade war picked up, American regulators rejection of Broadcom's bid to buy Qualcomm, Chinese regulators rejection of Qualcomm's bid to buy NXP Semiconductors, and Nvidia's weak outlook on gaming, artificial intelligence and data center, Cramer said.

The host also highlighted issues that struck the stock prices of Micron and Lam Research.

"So, [with] no more deals, declining demand for auto chips, a strangling by China that includes cellphone chips, overwhelming glut of commodity chips, and peaking in data center and gaming—the whole gamut of chipmakers seemed to be painting a picture of a worldwide slowdown and in every end market, coupled with an inability to consolidate an overpopulated group," Cramer said. "We had pain."

But as both the data center segment and trade negotiations between the U.S. and China appear to be improving, the outlook is better than before, he said. Furthermore, Nvidia's move for Mellanox doubles down on the data center and artificial intelligence segment, and eases worries that China would block the deal, the host said.

The PHLX Semiconductor Sector Index is still down more than 6 percent over the past year, but it has gained more than 17 percent in 2019.

"That's how a couple of research notes can lift an entire market, it seems fanciful but it's true, as so many stocks are caught up in these end markets that now seem to be more solid than most people think," Cramer said. "The semiconductor stocks have changed the market's perception to the positive. You know what? I'd buy any of the ones I just mentioned anytime they pull back."