North Korea's nuclear test is a "grave threat" to Japan, Prime Minister Shinzo Abe said Tuesday, hours after Pyongyang confirmed it had successfully detonated an atomic device.

"(The test) is a grave threat to the safety of our country and a serious challenge against the global framework of nuclear disarmament and non-proliferation," Abe said in a statement.

"It cannot be tolerated, as it will significantly damage safety and peace in northeast Asia and the international community."

The hawkish Abe swept to power in a landslide election victory last December, in part due to his hardline stance on foreign policy.

Last month Japan launched two satellities in a move it said was intended to strengthen its surveillance capabilities and enhance national security.