China's Xinhua news agency, the mouthpiece of Beijing, quickly urged restraint after North Korea's nuclear test on Friday.

State-run Xinhua said in a commentary that the nuclear test had "shocked the world" and was in violation of U.N. Security Council resolutions, as well as running counter to the goal of denuclearization on the the Korean Peninsula.

The test, which reclusive North Korea claimed was a complete success, also added uncertainty to an already delicate and complicated geopolitical security situation, Xinhua said.

"All parties including North Korea should recognize that tumult on the peninsular, war and instability in Northeast Asia will benefit nobody," the commentary added.

The nuclear test was "unwise," the news agency, which is watched closely as a proxy for the Chinese government, concluded.

China is North Korea's only ally but has become increasingly impatient with the rogue nation, going as far as supporting new U.N sanctions against North Korea earlier this year.

But China's stance is complicated by the fact that it is also concerned by South Korea's recent deal with the U.S. to host an anti-missile defense system called THAAD - something North Korea has also opposed. The Xinhua commentary noted that South Korea's deal with the U.S on THAAD had contributed to a rise in tensions in the Korean Peninsula.

In a brief statement on Friday, China's Foreign Ministry said that was firmly opposed its neighbor's latest test and strongly urged North Korea to stop taking actions that heightened tension in the region.

China would stick to its promise of denuclearizing the Korean Peninsula and taking part in talks to resolve the issue, the ministry said.

Follow CNBC International on Twitter and Facebook.

