North Korea conducted its third nuclear test on Tuesday in defiance of U.N. resolutions, drawing condemnation from around the world, including from its only major ally, China, which summoned the North Korean ambassador to protest.
Pyongyang said the test was an act of self-defence against "U.S. hostility" and threatened stronger steps if necessary.
The test puts pressure on U.S. President Barack Obama on the day of his State of the Union speech and also puts China in a tight spot, since it comes in defiance of Beijing's admonishments to North Korea to avoid escalating tensions.
The U.N. Security Council held an emergency meeting at which its members, including China, "strongly condemned" the test and vowed to start work on appropriate measures in response, the president of the council said.
North Korean leader Kim Jong-un, the third of his line to rule the country, has presided over two long-range rocket launches and a nuclear test during his first year in power, pursuing policies that have propelled his impoverished and malnourished country closer to becoming a nuclear weapons power.
North Korea said the test had "greater explosive force" than those it conducted in 2006 and 2009. Its KCNA news agency said it had used a "miniaturised" and lighter nuclear device, indicating it had again used plutonium, which is suitable for use as a missile warhead.
China, which has shown signs of increasing exasperation with the recent bellicose tone of its reclusive neighbour, summoned the North Korean ambassador in Beijing and protested sternly, the Foreign Ministry said.
Foreign Minister Yang Jiechi said China was "strongly dissatisfied and resolutely opposed" to the test and urged North Korea to "stop any rhetoric or acts that could worsen situations and return to the right course of dialogue and consultation as soon as possible".
Analysts said the test was a major embarrassment to China, which is a permanent member of the Security Council and North Korea's sole major economic and diplomatic ally.
Obama called the test a "highly provocative act" that hurt regional stability. "The danger posed by North Korea's threatening activities warrants further swift and credible action by the international community. The United States will also continue to take steps necessary to defend ourselves and our allies," Obama said.
U.S. Ambassador to the United Nations Susan Rice said Washington and its allies intended to "augment the sanctions regime" already in place due to Pyongyang's previous atomic tests. North Korea is already one of the most heavily sanctioned states in the world and has few external economic links that can be targeted.
Japanese Prime Minister Shinzo Abe said the test was a "grave threat" that could not be tolerated.
Russian Foreign Minister Sergei Lavrov urged North Korea to abandon its nuclear arms programme and return to talks. NATO condemned the test as an "irresponsible act."
South Korea, still technically at war with North Korea after a 1950-53 civil war ended in a mere truce, also denounced the test. Obama spoke to South Korean President Lee Myung-bak on Tuesday and told him the United States "remains steadfast in its defence commitments" to Korea, the White House said.
North Korea's Foreign Ministry said the test was "only the first response we took with maximum restraint".
"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," it said in a statement carried by the official KCNA news agency.
North Korea - which gave the U.S. State Department advance warning of the test - often threatens the United States and its "puppet", South Korea, with destruction in colorful terms.
North Korea told the U.N. disarmament forum in Geneva that it would never bow to resolutions on its nuclear program and that prospects were "gloomy" for the denuclearization of the divided Korean peninsula because of a "hostile" U.S. policy.
Suzanne DiMaggio, an analyst at the Asia Society in New York, said North Korea had embarrassed China with the test. "China's inability to dissuade North Korea from carrying through with this third nuclear test reveals Beijing's limited influence over Pyongyang's actions in unusually stark terms," she said.
Mark Fitzpatrick of the International Institute for Strategic Studies think tank, said: "The test is hugely insulting to China, which now can be expected to follow through with threats to impose sanctions."
The magnitude of the explosion was roughly twice that of the 2009 test, according to the Vienna-based Comprehensive Nuclear-Test Ban Treaty Organization. The U.S. Geological Survey said that a seismic event measuring 5.1 magnitude had occurred.
U.S. intelligence agencies were analysing the event and found that North Korea probably conducted an underground nuclear explosion with a yield of "approximately several kilotons", the Office of the Director of National Intelligence said.
Nuclear experts have described Pyongyang's previous two tests as puny by international standards. The yield of the 2006 test has been estimated at less than 1 kiloton (1,000 tons of TNT equivalent) and the second at some 2-7 kilotons, compared with 20 kilotons for a Nagasaki-type bomb.
Initial indications are that the test involved the latest version of a plutonium-based prototype weapon, according to one current and one former U.S. national security official. Both previous tests involved plutonium. If it turns out the test was of a new uranium-based weapon, it would show that North Korea has made more progress on uranium enrichment than previously thought.
The United States uses WC-135 Constant Phoenix "sniffer" aircraft to collect samples to identify nuclear explosions. These would need to be deployed quickly to detect whether highly enriched uranium rather than plutonium was used because uranium decays to undetectable levels within a matter of days. Plutonium takes much longer to decay.
North Korea trumpeted news of the test on its state television channel to patriotic music against a backdrop of its national flag.
"It was confirmed that the nuclear test that was carried out at a high level in a safe and perfect manner using a miniaturised and lighter nuclear device with greater explosive force than previously did not pose any negative impact on the surrounding ecological environment," KCNA said.
North Korea linked the test to its technical prowess in launching a long-range rocket in December, a move that triggered the U.N. sanctions, backed by China, that Pyongyang said prompted it to take Tuesday's action.
The North's ultimate aim, Washington believes, is to design an intercontinental ballistic missile capable of carrying a nuclear warhead that could hit the United States. North Korea says the programme is aimed at putting satellites in space.
Despite its three nuclear tests and long-range rocket tests, North Korea is not believed to be close to manufacturing a nuclear missile capable of hitting the United States.
It used plutonium in previous nuclear tests and before Tuesday there had been speculation that it would use highly enriched uranium so as to conserve its plutonium stocks, as testing eats into its limited supply of materials to construct a nuclear bomb.
When Kim Jong-un, who is 30, took power after his father's death in December 2011, there were hopes that he would bring reforms and end Kim Jong-il's "military first" policies.
Instead, North Korea, whose economy is smaller than it was 20 years ago and where a third of children are believed to be malnourished, appears to be trapped in a cycle of sanctions followed by further provocations.
"The more North Korea shoots missiles, launches satellites or conducts nuclear tests, the more the U.N. Security Council will impose new and more severe sanctions," said Shen Dingli, a professor at Shanghai's Fudan University. "It is an endless, vicious cycle."
Options for the international community appear to be in short supply. Diplomats at the United Nations said negotiations on new sanctions could take weeks since China is likely to resist tough new measures for fear they could lead to further retaliation by the North Korean leadership.
Beijing has also been concerned that tougher sanctions could further weaken North Korea's economy and prompt a flood of refugees into China. Tuesday's action appeared to have been timed for the run-up to Feb. 16 anniversary celebrations of Kim Jong-il's birthday, as well as to achieve maximum international attention.
Significantly, the test comes at a time of political transition in China, Japan and South Korea, and as Obama begins his second term. The U.S. president will likely have to tweak his State of the Union address due to be given on Tuesday.
Japanese Prime Minister Shinzo Abe is bedding down a new government and South Korea's new president, Park Geun-hye, is preparing to take office on Feb. 25.
China too is in the midst of a once-in-a-decade leadership transition to Xi Jinping, who takes office in March. Both Abe and Xi are staunch nationalists. The longer-term game plan from Pyongyang may be to restart international talks aimed at winning food and financial aid. China urged it to return to the stalled "six-party" talks on its nuclear programme, hosted by China and including the two Koreas, the United States, Japan and Russia.
Its puny economy and small diplomatic reach mean that North Korea struggles to win attention on the global stage - other than through nuclear tests and attacks on South Korea, the last of which was made in 2010.
"Now the next step for North Korea will be to offer talks... - any form to start up discussion again to bring things to their advantage," predicted Jeung Young-tae, senior research fellow at the Korea Institute for National Unification in Seoul.