The market "threw us a bit of a curve ball" Tuesday as investors avoided reliable defensive stocks even after Wall Street received critical evidence that the global economy is stumbling, CNBC's Jim Cramer said.

BASF, the gigantic German chemical manufacturer connected to the semiconductor, autos, pesticides and consumer products industries, revealed Monday that it may need to cut its full-year earnings forecast by 30%. The company blamed low car and crop sales, along with the U.S.-China trade war.

Cramer called the dim outlook "a very big deal."

"Now we've got real concern, real reason to be worried. While the Federal Reserve believes business is strong because we just got a terrific labor report last Friday," the "Mad Money" host said, "the weak forecast from chemical giant BASF suggests that the global economy might be in rougher shape than that employment number might indicate."

When industrial companies begin to falter, money managers usually put their money into the safe, consumer packaged goods sector because those consistent names tend to perform well even when the economy is slowing down. But Cramer said it was surprising to see PepsiCo, which reported solid quarterly results Tuesday morning and maintained its forecast, fall 0.62% during the session.

Pepsi's action impacted the rest of the soft goods sector, he added.

"Suddenly, we lost our favorite place to hide in a BASF-highlighted slowdown," Cramer said. "It flowed into the stocks of tech companies with fast growth that do not need a strong economy to make the numbers. These tech companies are all about making other businesses more productive, either using the cloud or big data or analytics, [and] will do fine in a slowdown."

Money spilled into cybersecurity stocks like Fortinet, Palo Alto Network and Okta, Cramer said.

"To me, it seemed like much of the bullish action here stemmed from the analysts rolling out a positive coverage of CrowdStrike, the newly-public cloud-based cybersecurity firm," he said.

Payment processing companies also got a boost on the market, including Square, PayPal and Wex.

Semiconductor stocks have struggled recently, but investors showed the oversold group some love with Advanced Micro Devices, Western Digital, Micron and Analog Devices, he said. The group rallied as much as 3.46% Tuesday.

Cramer also pointed to defense technology and medical technology stocks such as L3harris Technologies and Edwards Lifesciences. Facebook also moved up more than $3 per share, he noted.

"The bottom line: When investors start worrying about the global economy ... either money flows into the slow-and-steady consumer packaged goods stocks, like a PepsiCo, or it goes into the turbo-charged growth stocks that can thrive in a slowdown," Cramer said. "Today, smoking-hot growth won. Tomorrow? Who knows."