The underground explosion could take North Korea a big step closer to its goal of building a nuclear warhead small enough to be mounted on a long-range missile that could threaten the United States.
Official state media said the test was conducted in a safe manner and is aimed at coping with "outrageous" U.S. hostility that "violently" undermines the North's peaceful, sovereign rights to launch satellites. North Korea faced sanctions after a December launch of a rocket the U.N. and Washington called a cover for a banned missile test.
The North said it used a "lighter, miniaturized atomic bomb" that still has more explosive force than past tests. (Read full statement)
The United States Geological Survey said earlier Tuesday that it had detected a 4.9 magnitude earthquake in North Korea.
The nuclear test is North Korea's first since leader Kim Jong Un took power in December 2011 following the death of his father, Kim Jong Il, and marks a bold statement for the young leader as he unveils his domestic and foreign policy for a country long estranged from the West.
Experts say regular tests are needed to perfect North Korea's goal of building nuclear warheads small enough to be placed on long-range missiles. This atomic test - North Korea's third since 2006 - is expected to take Pyongyang closer to possessing nuclear-tipped missiles designed to strike the United States.