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 aimed at coping with "outrageous" US hostility that "violently" undermined the North's peaceful, sovereign rights to launch satellites.
North Korea faced sanctions after a December launch of a rocket the UN and Washington called a cover for a banned missile test.
The North said it used a "lighter, miniaturised atomic bomb" that still has more explosive force than past tests.
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.
Pyongyang's ally China said it is firmly opposed to the latest nuclear test, and called for new talks.
Beijing has become increasingly frustrated with the North's behaviour and issued an unusually strong reaction to the December rocket test by agreeing to tightened United Nations sanctions on the country.
However, today's statement from the Foreign Ministry did not point to any specific action Beijing would take in response to the latest nuclear test.
While saying that China was expressing its "firm opposition" to the test, the statement called for a calm response by all sides and said issues should be resolved within the framework of long-stalled denuclearisation talks involving North Korea, China, the US, South Korea, Japan and Russia.
The White House called North Korea's latest nuclear test a "highly provocative act" that threatens US security and international peace.
In a statement, US President Barack Obama promised to "continue to take steps necessary to defend ourselves and our allies."
He also urged "swift and credible action by the international community."
President Obama said such efforts "do not make North Korea more secure."
Instead, he said, North Korea had "increasingly isolated and impoverished its people through its ill-advised pursuit of weapons of mass destruction."
Nato has condemned North Korea's nuclear test, calling it "irresponsible" and a flagrant violation of UN Security council actions.
It called on the country to immediately cease such "provocative actions."
Other world leaders and opinion-formers were quick to add their criticism:
"It is deplorable that Pyongyang defied the strong and unequivocal call from the international community to refrain from any further provocative measures." - UN Secretary-General Ban Ki-moon.
North Korea's nuclear weapons and ballistic missile programs constitute a threat to US national security and to international peace and security. The United States remains vigilant in the face of North Korean provocations and steadfast in our defence commitments to allies in the region." - US president Barack Obama.
This nuclear test by North Korea is totally unacceptable, as it constitutes a grave threat to Japan's security, represents a grave challenge to the international disarmament and non-proliferation regime centred on the Nuclear Non-proliferation Treaty, and seriously undermines the peace and security of Northeast Asia ..." - Japanese Prime Minister Shinzo Abe.
The Democratic People's Republic of Korea, heedless of widespread international opposition, has again carried out a nuclear test, to which the Chinese government expresses its firm opposition." - China's Foreign Ministry.
North Korea's development of its nuclear and ballistic missile capabilities poses a threat to international and regional security. Its repeated provocations only serve to increase regional tension, and hinder the prospects for lasting peace on the Korean Peninsula." - Foreign Secretary William Hague.
""We call upon the DPRK to refrain from such actions which adversely impact on peace and stability in region." - Indian Foreign Ministry.
"It constitutes a clear threat to international peace and security and challenges efforts to strengthen global nuclear disarmament and non-proliferation. I am gravely concerned by this action, which deserves universal condemnation." - Tibor Tóth, executive secretary of the Preparatory Commission for the Comprehensive Nuclear-Test-Ban Treaty Organisation.
Countdown to a nuclear North Korea
Experts believe North Korea remains far from having a nuclear-armed missile that could threaten the United States, which would require an accurate long-range rocket and a nuclear warhead that could be mounted on it. Here is a look at its progress so far:
- ROCKET LAUNCH (August): This early launch gets the world's attention, because it goes well beyond North Korea's known capability. The rocket, which hurtles over Japan, has an estimated potential range of 1,550 miles, but accuracy is reportedly poor with no meaningful strike capability.
- ROCKET LAUNCH (July): A three-stage rocket with a potential range of 4,100 miles fizzles soon after lift off. North Korea has never acknowledged the launch.
- NUCLEAR TEST (October): North Korea detonates a nuclear device for the first time, but the yield is a very low 0.5 to 1 kiloton.
- ROCKET LAUNCH (April): This launch is a partial success, with two of the three stages pushing the rocket out over the Pacific. The third stage fails, and, despite North Korea's claims of success, no satellite is put into orbit. The rocket dubbed Unha-2 represents a significant advancement over previous rockets.
- NUCLEAR TEST (May): Second detonation of a nuclear device is a partial success with a larger yield of 2 to 6 kilotons, but still below the 10 kilotons that experts consider a successful blast.
- ROCKET LAUNCH (April 2012): Launch of Unha-3 rocket, with a potential range of 6,200 miles, ends in embarrassing failure, splintering into pieces over the Yellow Sea soon after take off. Hours later, the country acknowledges the satellite failed to enter orbit in an announcement on state TV.
- ROCKET LAUNCH (December 2012): This time, the rocket succeeds in launching a satellite into space. Its range, though questioned by some experts, in theory puts the US West Coast, Hawaii, Australia and eastern Europe within striking distance.
- NUCLEAR TEST (February 2013): North Korea says it detonates a miniaturised nuclear device. If true, this would be an advance, as North Korea needs to master the technology to make a nuclear device small enough to mount on a missile. Early estimates put the yield at 6 to 7 kilotons, but that has yet to be confirmed.
COMMENT RULES: Comments that are judged to be defamatory, abusive or in bad taste are not acceptable and contributors who consistently fall below certain criteria will be permanently blacklisted. The moderator will not enter into debate with individual contributors and the moderator’s decision is final. It is Belfast Telegraph policy to close comments on court cases, tribunals and active legal investigations. We may also close comments on articles which are being targeted for abuse. Problems with commenting? email@example.com