The collaboration of the U.S. and China on a fentanyl crackdown is a key step in trade negotiations between the world's two largest economies, CNBC's Jim Cramer said Thursday.

"This is what President Trump was waiting for," Cramer said of China's decision to send nine people to prison, one of whom received a suspended death sentence, for smuggling fentanyl into the United States.

"It's far more important than any nonsense about tariffs," the "Mad Money" host added, referring to China saying Thursday that it agreed with the U.S. to lift existing trade tariffs in steps as talks continue to complete last month's promise of a "phase one" trade deal.

Trump has widely criticized Beijing for not doing enough to prevent fentanyl, a highly addictive synthetic opioid, from coming into the United States. Beijing denies that most of the illicit fentanyl entering the U.S. originates from China.

Thursday's sentencing, which stemmed from a 2017 tip from the U.S. Homeland Security Department, is vital for Washington as it approaches trade negotiations with Beijing, Cramer said. Though a senior official with China's National Narcotics Control Commission did say the case should not be connected to the trade war.

"My contacts at the White House say, 'at last,' because President Trump cares passionately about overdose and passionately about drug use," Cramer said. "He didn't want to sit down until this one of the 'seven deadly sins' was agreed to." The White House was not immediately available to respond to CNBC's request for comment on Cramer's remarks.

While Wall Street soared Thursday on those China comments about possible tariff relief, Cramer said the fentanyl sentencing sends a stronger message about China's willingness to work with the U.S.

— Reuters contributed to this report.