The United Nations Security Council is strongly condemning North Korea over its latest nuclear test and says it will take further action.

The 15-member council said the test represented "a clear threat to international peace and security."

North Korea's test defied previous United Nations Security Council orders to shut down its nuclear development program.

Earlier Tuesday, North Korea followed through with its threat to conduct a third nuclear test. The regime announced that it had detonated a miniaturized nuclear device at an underground test site.

The statement came several hours after seismic activity was detected and reported by South Korean, American and Japanese monitoring agencies. The agencies detected an earthquake with a magnitude between 4.9 and 5.2.

North Korea's official Korean Central News Agency said the test was conducted safely and with more explosive power than previous tests. It also called the test a realistic response to new sanctions that were imposed on North Korea after it launched a rocket in December. It reported that Tuesday's test was in reaction to "outrageous" hostility from the U.S. and that North Korea was protecting its sovereignty.

"This nuclear test was only the first response we took with  maximum restraint," a North Korea Foreign Ministry spokesman said in a statement on the country's news agency, Reuters reported.

northkorea

North Korea conducted its latest nuclear test at an underground site on Tuesday. (CBC)

"If the United States continues to come out with hostility and complicates the situation, we will be forced to take stronger, second and third responses in consecutive steps."

North Korea's latest test also ignores the warnings of its close ally China not to proceed with a nuclear test.

A statement from China's foreign ministry signaled the country's growing frustration with its neighbour.

"The Democratic People's Republic of Korea conducted another nuclear test in disregard of the common opposition of the international community. The Chinese government is firmly opposed to this act," it read.

The government said that it wants the Korean peninsula denuclearized and wants to prevent nuclear proliferation and safeguard stability in the region. It urged North Korea to "honour its commitment to denuclearization and refrain from any move that may further worsen the situation."

China urges 'cool-headed' response

China said all parties should respond in a "cool-headed manner" and pursue denuclearization talks, but the foreign ministry didn't indicate what actions it might take in response to the test. North Korea carried out the test as China is in the midst of its New Year celebrations and most people are still on holiday.

North Korea's action will now heighten tensions with its only major ally that has long provided it with aid and investment. In January, China agreed to support tougher UN sanctions against North Korea, a move that surprised some given its traditional protection of the alienated country.

Ted Lipman, Canada's former ambassador to North Korea and South Korea, told CBC News that China doesn't want its economic interests threatened by instability in the region. Lipman, who served as ambassador from 2007 until 2011, said China isn't likely though to make any drastic changes in its attitude toward its neighbour.

"China hasn't been very nimble in changing its policy towards North Korea," he said. "China may have to reassess its interests, and I think it is doing that, but in terms of changing of its policy, it has not been quick to do so."

If North Korea eventually does develop a nuclear weapon there are concerns about whose hands it might fall into and about the potential for an arms race in the region, said the former diplomat, who now lives in Hong Kong. But he's doubtful North Korea would aim and fire at a target.

"I don't think that's in the cards," he said.

The international community had been bracing for this test and on Monday, China's Foreign Minister Yang Jiechi and U.S. Secretary of State John Kerry spoke by phone about  North Korea's "continued provocative rhetoric." State Department spokeswoman Victoria Nuland said Kerry also spoke to his counterparts in Japan and South Korea.

U.S. President Barack Obama, scheduled to give his state of the union address on Tuesday, called the nuclear explosion a "highly provocative act" that threatens his country's security and international peace.

"The danger posed by North Korea's threatening activities warrants further swift and credible action by the international community," Obama said in a statement. "The United States will also continue to take steps necessary to defend ourselves and our allies."

"These provocations do not make North Korea more secure," Obama said. "Far from achieving its stated goal of becoming a strong and prosperous nation, North Korea has instead increasingly isolated and impoverished its people through its ill-advised pursuit of weapons of mass destruction and their means of delivery."

Test called 'misguided threat'

Canadian Foreign Affairs Minister John Baird  called the test a "serious, misguided threat to regional peace and security."

"The North Korean regime's reckless disregard for the global will is again on display," Baird said. "What makes such actions even more unconscionable is the fact that the North Korean people starve and are denied their basic human dignity while the Pyongyang regime squanders limited resources."

He said Canada will co-operate with the international community" to pursue all appropriate actions and sanctions against the rogue regime in North Korea."

This is North Korea's third nuclear test since 2006 and the first under Kim Jong Un's leadership. It took place only days before the Saturday birthday of Kim's father, late leader Kim Jong Il, whose memory North Korean propaganda has repeatedly linked to the country's nuclear ambitions.

Following the announcement of the nuclear test, North Korean state television played a song with lyrics bragging that the country always carries out what it is determined to do. In the background were scenes of a North Korean long-range rocket blasting off and short-range missiles being fired into the sky.

North Korea's National Defense Commission said Jan. 23 that the United States was its prime target for a nuclear test and long-range rocket launches. North Korea accuses Washington of leading the push to punish Pyongyang for its December rocket launch.

UN chief Ban Ki-moon condemned the test in a statement, saying it is "a clear and grave violation" of Security Council resolutions.

"It is deplorable that Pyongyang defied the strong and unequivocal call from the international community to refrain from any further provocative measures," the statement said.

It also said the UN secretary general is "gravely concerned about the negative impact of this deeply destabilizing act on regional stability as well as the global efforts for nuclear non-proliferation."

He urged North Korea to reverse course and said he's confident the Security Council will remain united and take appropriate action.

It's not clear whose side China will take when it comes to taking further action against North Korea.

NATO also condemned the test and said in a statement that it was a flagrant violation of the United Nations. "This irresponsible act, along with the December missile launch, poses a grave threat to international peace, security and stability," it said. 

With files from Associated Press