"This nuclear test was only the first response we took with maximum restraint," an unnamed spokesman for the North Korean foreign ministry said in a statement carried by the official KCNA news agency.
"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." The agency did not say what those steps might be.
China joined the US, Japan,
South Korea and other countries in condemning the test, the third North Korea has conducted since 2006.
The Chinese foreign minister, Yang Jiechi, said Beijing was "strongly dissatisfied and resolutely opposed" to the test and urged the North to end its bellicose rhetoric and "or acts that could worsen the situation, and return to the right course of dialogue and consultation as soon as possible".
Analysts said the test had embarrassed China, the North's only ally and its biggest aid donor. "The test is hugely insulting to China, which now can be expected to follow through with threats to impose sanctions," Mark Fitzpatrick of the International Institute for Strategic Studies told Reuters.
North Korea's diplomats blasted UN resolutions, calling on it to abandon its
nuclear weapons programme, and blamed Washington for the "gloomy" prospects for denuclearisation on the Korean peninsula.
"The US and their followers are sadly mistaken if they miscalculate [North Korea] would respect the entirely unreasonable resolutions against it. [North Korea] will never bow to any resolutions," Jon Yong-ryong, first secretary of North Korea's mission in Geneva, told the Conference on Disarmament.
The test, which took place in the north-east of the country just before noon local time, could bring North Korea closer to developing a nuclear warhead small enough to be mounted on a long-range missile and possibly bringing the west coast of the US within striking distance.
The authorities in Pyongyang said scientists had set off a "miniaturised" nuclear device with a greater explosive force than those used in two previous nuclear tests, in 2006 and 2009.
"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," the KCNA announced.
The agency said the test had been in response to "outrageous" US hostility that "violently" undermined the regime's right to peacefully launch satellites – a reference to the condemnation and tighter sanctions that greeted Pyongyang's successful rocket launch almost two months ago.
Tuesday's test was quickly condemned by the UN general secretary, Ban Ki-moon, who said it was "deplorable" that Pyongyang had defied international calls to abandon it, adding that it was a "clear and grave violation of the relevant UN security council resolutions".
Barack Obama said the test was a highly provocative act that violated security council resolutions and posed a threat to US and international security. The US president called for "further swift and credible action by the international community" against North Korea.
William Hague, the UK foreign secretary, joined the international chorus of condemnation and warned North Korea faced further isolation if it did not stop developing its nuclear and ballistic missile capabilities.
Diplomats said the UN security council was convening an emergency meeting in response, although with so many sanctions in place against the regime after previous nuclear tests and rocket launches it is not clear what options remain open to the international community.
Any push for a fresh round of sanctions could take weeks. The US, South Korea, Japan and European nations are expected to call for further sanctions against the North for defying previous security council resolutions banning it from testing nuclear weapons and ballistic missile technology.
A UN body that monitors nuclear tests said earlier it had detected an "unusual seismic event" in North Korea. "The event shows clear explosion-like characteristics and its location is roughly congruent with the 2006 and 2009 [North Korea] nuclear tests," said Tibor Tóth, the executive secretary of the Comprehensive Nuclear-Test-Ban Treaty Organisation in Vienna.
The agency said it constituted "a clear threat to international peace and security, and challenges efforts made to strengthen global nuclear disarmament and non-proliferation, in particular by ending nuclear testing".
Seismic activity had been picked up by the US geological survey and monitoring stations in South Korea. It appeared to be a more powerful blast than the North's two previous tests.
Experts in South Korea, the US and Japan put the quake at magnitudes of between 4.7 and 5.2. Earthquakes of magnitude 3.9 and 4.5 respectively were detected in the North's 2006 and 2009 nuclear tests. The US geological survey said Tuesday's seismic activity had been magnitude 4.9.
The South Korean government raised its military alert level, while Japan was preparing to dispatch military aircraft to look for signs of atmospheric radiation.
Tensions have been running high in the region since North Korea threatened to conduct a nuclear test in protest at fresh UN sanctions imposed after the regime successfully launched a satellite into orbit in mid-December.
The North again raised the diplomatic stakes when its most powerful military body, the National Defence Commission, warned its ballistic missile and nuclear weapons programmes were targeted at the US.
Any progress the North makes in its missile and nuclear programmes is a cause for concern, although it is thought to be some way off having the ability to produce a nuclear warhead small enough to mount on a reliable long-range missile.
North Korea has enough plutonium to build between four and eight nuclear weapons, according to Siegfried Hecker, a nuclear scientist who visited the country's main Yongbyon nuclear complex in 2010.
Other reports suggest the country has enough fissile material for about a dozen plutonium warheads. In 2009, the regime said it would begin enriching uranium, giving it another means of building a nuclear arsenal.
Speculation had been mounting that this third test could involve a uranium device – a clear signal that North Korea's scientists have mastered the ability to produce highly enriched uranium.
In October 2012, a spokesman from the North's national defence commission told state media the country had built a missile capable of striking the US but did not provide further details. A missile featured in an April 2012 military parade appeared to be an intercontinental ballistic missile but its authenticity has not been verified by foreign experts.
Daniel Pinkston of the International Crisis Group in Seoul said: "The question is whether things could spiral. I agree there should be some costs and consequences, but as far as believing the consequences should deter them – I think that's wishful thinking.
"The [North Koreans] view the world as hostile and menacing; and if even China is hostile, then even more so. Other people might think OK, they will be more cautious and have second thoughts because even China will take action. But, from their point of view, it reaffirms why they need [a nuclear programme]. When the world is like this, do you not want to be a nuclear power?"