China summoned the North Korean ambassador and delivered a stern protest and, as in the case of previous tests, the foreign ministry called for calm and denuclearisation talks. However, China stopped short of the harsh criticism it unleashed in 2006 when it described the country's first nuclear test as "brazen".
Beijing agreed to extend United Nations sanctions after North Korea launched a rocket in December, signing up to a UN Security Council resolution that warned of "significant action" against further missile or nuclear tests. It had signalled its unhappiness with Pyongyang in the run-up to Tuesday's test, which was felt on the Chinese side of the border.
Even so, it will not cut off its neighbour and is likely to oppose the toughest measures sought by the United States and others, analysts say.
China is North Korea's main trading partner and supplier of aid, providing an estimated half a million tonnes of oil annually as well as much-needed food supplies.
But analysts say it has become increasingly annoyed by North Korea's intransigence, particularly after its attempts to increase engagement.
Security-related action
"China tried to help the North to focus on economic growth rather than the military-first policy. Its logic was that if we could help them shift from military and ideological to national interests they would become more reasonable. That was China's logic: to make them negotiable," said Jin Canrong, a foreign policy scholar at Renmin University. "This time, I think China's attitude will see some change."
Jin also pointed to the speed with which the Security Council had convened a meeting, within 12 hours of the test and that, "in the past, [China] would debate with the US about a meeting for several days ".
Jin said China would probably support economic measures but would shun security-related action such as signing up to the Proliferation Security Initiative.
North Korea and China were once said to be as close as "lips and teeth", but they have long had an ambivalent relationship weighted with mutual suspicion. After Pyongyang tested missiles in 2009, He Yafei, then China's deputy foreign minister, told an American diplomat that North Korea was acting like a "spoiled child" because it wanted to engage the attention of the "adult" – meaning the US – according to cables obtained by WikiLeaks.
Analysts say Beijing fears that a collapse of the regime could lead to instability, with refugees trying to escape over the border or dangerous conflicts within the political elite and, with reunification, the arrival of American troops on its doorstep.
It is also reluctant to lean too heavily on Pyongyang, particularly if that alienates the North further and encourages its pursuit of direct dealings with the US. Su Hao, of the China Foreign Affairs University, recently told the Global Times, a state-run newspaper often used to float controversial ideas: "Most of the time, the whips for North Korea actually fall on the back of China."
At the same time, its influence over the regime, though limited, has proved a useful diplomatic card to play. "In the past 10 years, China has felt frustrated about the North's behaviour many times and will have concluded from Kim Jong-un's behaviour that he is even more volatile and provocative than his father," said Shi Yinhong, another international relations expert at Renmin University.
Sanctions resolutions
"It's still in a dilemma. I don't think it will abandon North Korea. It will probably support new sanctions resolutions, but not as strong as the US [would like]. It thinks they are counterproductive."
Rory Medcalf, the director of the international security programme at the Lowy Institute, said a "very short, concentrated economic signal, such as cutting off oil for a couple of days" would send a sign to North Korea, without destabilising it.
Medcalf said: "The constant debate within China was temporarily resolved in 2010 in favour of largely unqualified tolerance of North Korea's provocation. Since then, there has been such an accumulation of provocation. China does not want multiple international crises on its hands at a time when its leadership should be focused on domestic problems. It already has a crisis with Japan [over the islands in the East China Sea]."
He said the new leadership under Xi Jinping might find it easier to change course because it was not invested in the old policy.
China's foreign ministry made its frustrations unusually visible last month when its spokesperson, Hong Lei, discussing North Korea's military spending, told reporters: "We would like to actively encourage the relevant country to develop the economy and improve people's living conditions."
The Global Times said last week that North Korea should pay a heavy price for another nuclear test: "The various kinds of aid it receives from China will be decreased for good reasons." – © Guardian News & Media 2013