North Korea has carried out its third, most powerful nuclear test despite UN warnings, and said "even stronger" action might follow.
It described the test as a "self-defensive measure" necessitated by the "continued hostility" of the US.
Its main ally, China, criticised the test, which was condemned worldwide.
Nuclear test monitors in Vienna say the underground explosion had double the force of the 2009 test, despite reportedly involving a smaller device.
If, as North Korea reports, a smaller device was tested successfully, analysts say this could take Pyongyang closer to building a warhead small enough to arm a missile.
The UN Security Council will meet at 14:00 GMT to discuss the test and its ramifications, diplomats say.
North Korea announced last month that it would conduct a third nuclear test following those in 2006 and 2009 as a response to UN sanctions that were expanded after the secretive communist state's December rocket launch, a move condemned by the UN as a banned test of missile technology.
Activity had been observed at the Punggye-ri nuclear test site for several months.
Seismic activity was then detected by monitoring agencies from several nations at 11:57 (02:57 GMT) on Tuesday. A shallow earthquake with a magnitude of 4.9 was recorded, the US Geological Survey said.
Confirmation of the test came three hours later in a statement from the state-run KCNA news agency.
"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," it said.
North Korea said the nuclear test - which comes just before US President Barack Obama's State of the Union address - was a response to the "reckless hostility of the United States".
"The latest nuclear test was only the first action, with which we exercised as much self-restraint as possible," the foreign ministry said in a statement.
"If the US further complicates the situation with continued hostility, we will be left with no choice but to take even stronger second or third rounds of action."
The Vienna-based Comprehensive Nuclear-Test-Ban Treaty Organisation said the "explosion-like event" was twice as big as the 2009 test, which was in turn bigger than that in 2006.
It is the first such test under new leader Kim Jong-un, who took over the leadership after his father Kim Jong-il died in December 2011.
UN Secretary General Ban Ki-moon condemned the test as a "clear and grave violation" of UN resolutions and a "deeply destabilising" provocation.
Mr Obama said the test was a "highly provocative act", and called for "swift" and "credible" international action in response.
China expressed "firm opposition" to its ally's test, urging the North to honour its commitment to denuclearisation and "not take any actions which might worsen the situation".
In other reaction:
- Russian Foreign Minister Sergei Lavrov said the North should "abandon its nuclear arms programme", and he called for the revival of talks on the issue
- South Korea's presidential national security adviser, Chun Young-woo, said the test was an "unacceptable threat to the security of the Korean peninsula and north-east Asia... and a challenge to the whole international community"
- Japanese Prime Minister Shinzo Abe said it was a "grave threat" to Japanese security and could "not be tolerated"
- Nato described the test as an "irresponsible act" and a "grave threat to international and regional peace, security and stability"
- Britain called for a "robust response" from the UN Security Council
- French President Francois Hollande condemned the test and said Paris would back firm action by the UN Security Council
The BBC's Lucy Williamson, in Seoul, says the trouble, as ever, is what the international community can do in response without triggering an even bigger crisis - North Korea is already tied up in layers of sanctions which do not seem to have had any impact.
She adds that some in Washington have talked of maybe targeting North Korean financial interests, but the only real pressure is seen to lie with China.
By defying the UN and launching its nuclear test now, our correspondent says, Pyongyang is giving the new leadership in Beijing a very public test of its own.