Spokeswoman Hua Chunying told reporters that Beijing had not been given advanced warning of the test and would be summoning Pyongyang's ambassador to lodge a protest.
"If they don't solve that problem, we should be very tough on them on trade -- meaning, start charging them tax or start cutting them off. You'd have China collapse in about two minutes," he said.
"If there was ever a moment for the Chinese to decide that now is the time that we really have to do something, this is it," said Mike Chinoy, former CNN international correspondent and the author of "Meltdown: The inside story of the North Korean nuclear crisis
"The North Korean insult to China and Xi Jinping personally is really egregious. Xi Jinping is not a guy that takes this stuff lying down."
"The North Koreans really don't like the Chinese," said Chinoy.
"They resent the hell out of the Chinese. They hate the idea that the Chinese can come in and tell them what to do.
And the reality is the Chinese can't."
Relations between Pyongyang and Beijing have been frosty since Kim Jong Un succeeded his late father as dictator, promptly purging several key government figures -- such as his uncle Jang Song Thaek -- with strong ties to China.
Kim has never visited China as leader, nor has he met President Xi Jinping, despite reportedly lobbying to do so for several years.
China views Kim Jong Un as a "very rogue, irresponsible and brattish leader," said Lee Jung Hoon, professor of International Relations at Yonsei University.
Last month, Kim's personal Moranbong girl band flew to Beijing to play a series of shows, before abruptly canceling the tour and returning to North Korea
A dispatch by China's state-run Xinhua news agency later cited "communication issues at the working level" as the reason for the cancellation, which came in the same week North Korea first claimed it had added the hydrogen bomb to its arsenal.
Why does China support North Korea?
"The relationship is basically dysfunctional, but it serves everyone's interests," said Jeffrey Lewis
, director of the East Asia Nonproliferation Program at the James Martin Center for Nonproliferation Studies.
North Korea serves as a buffer for China between it and key U.S. ally -- and mutual defense signatory -- South Korea.
More than anything else, Beijing wants stability on its border, which, nuclear tests notwithstanding, Pyongyang largely provides.
"What China does not want is a dramatic implosion of North Korea, or a kinetic weapons war on its doorstep," said Jasper Kim, director of the Center for Conflict Management at South Korea's Ewha University.
A strong nuclear weapons program strengthens Kim Jong Un's regime and stabilises his rule, making it far less likely that he could be overthrown -- from inside or out -- and plunge the country into chaos, potentially sending millions of refugees pouring across the Chinese border.
North Korea is also a major tool for Beijing "in the bigger chess game of U.S.-China relations in the Asia Pacific region," said Yonsei's Lee.
History also plays a part, though less and less as the current generation of North Korean and Chinese leaders are more detached from the Korean War, during which Mao Zedong sent troops to support Kim Il Sung.
North Korea is one of the most sanctioned countries on Earth, with the United Nations, the U.S., European Union, and a host of other countries all imposing strict restrictions on doing business with the government or North Korean companies.
However, while Beijing has supported previous U.N. resolutions imposing greater sanctions, Chinoy says that actual "enforcement of sanctions on the Chinese side has not been that rigorous."
This lack of effective enforcement does mean there are steps that China could take immediately to up the pressure on Pyongyang, such as cutting off trade and oil links, and banning North Korean planes from entering Chinese airspace.
China could also stop state-owned and private firms from doing business in North Korea, such as in 2013, when the Bank of China stopped dealings with the North Korea Foreign Trade Bank, cutting Pyongyang off from a key source of foreign currency.
"My guess is China will do something tough and nasty but it won't be tough and nasty enough to make a difference," Chinoy said.
What happens next?
"A key barometer of how angry the Chinese are will be how much and in what way they try to water down any U.N. resolution," said Chinoy.
According to diplomatic sources, China tried unsuccessfully to block a U.N. Security Council meeting on the human rights situation in North Korea
The Security Council held an emergency meeting on Wednesday, the first step towards imposing new sanctions. In a statement, the Council reiterated its intention to take "further significant measures" against North Korea.
"This is one of the few occasions in the world where China, U.S., Russia really need to agree on something," said Victor Gao, director of the China National Association of International Studies.