North Korea said the atomic test was merely its "first response" to what it called U.S. threats, and said it will continue with unspecified "second and third measures of greater intensity" if Washington maintains its hostility.
The underground test, which set off powerful seismic waves, drew immediate condemnation from Washington, the U.N. and others. Even its only major ally, China, summoned the North's ambassador for a dressing-down.
President Barack Obama, who was scheduled to give a State of the Union address later Tuesday, said nuclear tests "do not make North Korea more secure." Instead, North Korea has "increasingly isolated and impoverished its people through its ill-advised pursuit of weapons of mass destruction," he said in a statement.
In an emergency session, the U.N. Security Council unanimously said the test poses "a clear threat to international peace and security" and pledged further action.
The test was a defiant North Korean response to U.N. orders that it shut down its atomic activity or face more sanctions and international isolation. It will likely draw more sanctions from the United States and other countries at a time when North Korea is trying to rebuild its moribund economy and expand its engagement with the outside world.
Several U.N. resolutions bar North Korea from conducting nuclear or missile tests because the Security Council considers Pyongyang a would-be proliferator of weapons of mass destruction and its nuclear testing a threat to international peace and stability. North Korea dismisses that as a double standard, and claims the right to build nuclear weapons as a defense against the United States, which has been seen as enemy No. 1 since the 1950-53 Korean War. The U.S. stations more than 28,000 troops in South Korea to protect its ally.
Tuesday's test is North Korea's first since young leader Kim Jong Un took power of a country long estranged from the West. The test will likely be portrayed in North Korea as a strong move to defend the nation against foreign aggression, particularly from the U.S.
"The test was conducted in a safe and perfect way on a high level, with the use of a smaller and light A-bomb, unlike the previous ones, yet with great explosive power," North Korea's official Korean Central News Agency said.
The U.N. Security Council recently punished North Korea for a rocket launch in December that the U.N. and Washington called a cover for a banned long-range missile test. Pyongyang said it was a peaceful launch of a satellite into space. In condemning that launch, the council demanded a stop to future launches and ordered North Korea to respect a ban on nuclear activity - or face "significant action" by the U.N.
China expressed firm opposition to Tuesday's test but called for a calm response by all sides. Chinese Foreign Minister Yang Jiechi summoned North Korea's ambassador and delivered a "stern representation" and demanded that North Korea "swiftly return to the correct channel of dialogue and negotiation," the ministry said in a statement.
The timing of the test is significant. It came hours before Obama's speech and only days before the Saturday birthday of Kim Jong Un's father, late leader Kim Jong Il, whose memory North Korean propaganda has repeatedly linked to the country's nuclear ambitions.
This year also marks the 60th anniversary of the signing of the armistice that ended the 1950-53 Korean War, and in late February South Korean President-elect Park Geun-hye will be inaugurated.
In Pyongyang, where it was snowing Tuesday, North Koreans gathered around televisions to watch a 3 p.m. TV broadcast announcing the nuclear test.
The test shows the world that North Korea is a "nuclear weapons state that no one can irritate," Kim Mun Chol, a 42-year-old Pyongyang citizen, told The Associated Press in the North Korean capital. "Now we have nothing to be afraid of in the world."
The National Intelligence Service in Seoul told lawmakers that North Korea may conduct an additional nuclear test and test-launch a ballistic missile in response to U.N. talks about imposing more sanctions, according to the office of South Korean lawmaker Jung Chung-rae, who attended the private meeting. Analysts have also previously speculated that Pyongyang might conduct multiple tests, possibly of plutonium and uranium devices.
North Korea is estimated to have enough weaponized plutonium for four to eight bombs, according to American nuclear scientist Siegfried Hecker.
It wasn't immediately clear to outside experts whether the device exploded Tuesday was small enough to fit on a missile, and whether it was fueled by plutonium or highly enriched uranium. A successful test would take North Korean scientists a step closer to building a nuclear warhead that can reach U.S. shores -seen as the ultimate goal of North Korea's nuclear program.
In 2006, and 2009, North Korea is believed to have tested devices made of plutonium. But in 2010, Pyongyang revealed a program to enrich uranium, which would give the country a second source of bomb-making materials - a worrying development for the U.S. and its allies.
"This latest test and any further nuclear testing could provide North Korean scientists with additional information for nuclear warhead designs small enough to fit on top of its ballistic missiles," Daryl Kimball and Greg Thielmann wrote on the private Arms Control Association's blog. "However, it is likely that additional testing would be needed for North Korea to field either a plutonium or enriched uranium weapon."
Uranium would be a worry because plutonium facilities are large and produce detectable radiation, making it easier for outsiders to find and monitor. However, uranium centrifuges can be hidden from satellites, drones and nuclear inspectors in caves, tunnels and other hard-to-reach places. Highly enriched uranium also is easier than plutonium to engineer into a weapon.
Monitoring stations in South Korea detected an earthquake in the North with a magnitude of 4.9 and the South's Defense Ministry said that corresponds to an estimated explosive yield of 6-7 kilotons.
The yields of the North's 2006 and 2009 tests were estimated at 1 kiloton and 2 to 6 kilotons, respectively, spokesman Kim Min-seok said. By comparison, U.S. nuclear bombs that flattened Nagasaki and Hiroshima during World War II were estimated at 13 kilotons and 22 kilotons, respectively, Kim said.
The test is a product of North Korea's military-first, or songun, policy, and shows Kim Jong Un is running the country much as his father did, said Daniel Pinkston of the International Crisis Group think tank.
The other part of a credible North Korean nuclear deterrent is its missile program. While it has capable short and medium-range missiles, it has struggled in tests of technology for long-range missiles needed to carry bombs to the United States, although it successfully launched the satellite in December.
North Korea isn't close to having a nuclear bomb it can use on the United States or its allies. Instead, Hecker said in a posting on Stanford University's website, "it wants to hold U.S. interests at risk of a nuclear attack to deter us from regime change and to create international leverage and diplomatic maneuvering room."
Associated Press writers Kim Kwang Hyon in Pyongyang, North Korea; Foster Klug, Hyung-jin Kim, Youkyung Lee and Sam Kim in Seoul, South Korea; Yuri Kageyama and Malcolm Foster in Tokyo; and Christopher Bodeen in Beijing contributed to this report.