SEOUL, South Korea — North Korea said it successfully detonated a miniaturized nuclear device at a northeastern test site Tuesday, defying U.N. Security Council orders to shut down atomic activity or face more sanctions and international isolation.

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. It will also be seen as a direct message from young leader Kim Jong Un to the United States, Pyongyang’s former wartime enemy.

North Korea’s 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 right to launch satellites. North Korea faced sanctions after a December launch of a rocket that the U.N. and Washington called a cover for a banned missile test. Pyongyang said it was a peaceful satellite launch.

The timing will be seen as significant. The test came hours before President Barack Obama was scheduled to give his State of the Union speech, a major, nationally televised address. It’s also 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.

The North said it used a “lighter, miniaturized atomic bomb” that still has more explosive force than past tests. North Korea is estimated to have enough weaponized plutonium for four to eight bombs, according to American nuclear scientist Siegfried Hecker. However, it is not known whether North Korean scientists have found a way to miniaturize warheads.

Earlier Tuesday, South Korean, U.S. and Japanese seismic monitoring agencies said they detected an earthquake in North Korea with a magnitude between 4.9 and 5.2.

The nuclear test is North Korea’s first since Kim Jong Un took power of 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 is North Korea’s third since 2006.

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., North Korea’s longtime enemy.

North Korea’s rocket launches and nuclear tests largely are seen by analysts as threats designed to force the United States to confront the issue of military tensions between the foes 60 years after the end of the Korean War.

Following the announcement of the nuclear test, North Korean state television played a song with lyrics bragging that the country always carries out what it is determined to do. In the background were scenes of a North Korean long-range rocket blasting off and short-range missiles being fired into the sky.

The United States and its allies have been on edge since North Korea announced last month that it would conduct a nuclear test to protest toughened sanctions over the December rocket launch.

In Washington, the White House had no immediate comment on Tuesday’s developments.

North Korea’s National Defense Commission said Jan. 23 that the United States was its prime target for a nuclear test and long-range rocket launches. North Korea accuses Washington of leading the push to punish Pyongyang for its December rocket launch.

Last October, a spokesman from the commission told state media that the country had built a missile capable of striking the United States, but did not provide further details.

The decision to push ahead with a test will be a challenge to the U.N. Security Council, which recently punished Pyongyang for launching the long-range rocket. In condemning that launch and imposing more sanctions on Pyongyang, the council had 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.

U.N. chief Ban Ki-moon condemned Tuesday’s nuclear test in a statement.

The test will likely draw harsh censure and 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.

North Korea cites the U.S. military threat in the region as a key reason behind its drive to build nuclear weapons. The two countries fought on opposite sides of the Korean War, which ended after three years on July 27, 1953, with an armistice, not a peace treaty. The U.S.-led U.N. Command mans the Demilitarized Zone dividing the two Koreas, and Washington stations more than 28,000 troops in South Korea to protect the ally.

___