In a speech made after Pyongyang carried out its third nuclear test, Mr Panetta likened the North to Iran, describing them as “rogue states”.
In New York, the UN Security Council “strongly condemned” the nuclear test.
The council said it would begin work on measures against North Korea, after UN chief Ban Ki-moon said the test was a “clear and grave violation”.
Earlier, Pyongyang said “even stronger” action might follow, saying its test was a response to US “hostility”.
Nuclear test monitors in Vienna say the underground explosion had double the force of the last test, in 2009, despite the use of a device said by the North to be smaller.
If a smaller device was indeed tested, analysts said this could take Pyongyang closer to building a warhead small enough to arm a missile.
UN sanctions on North Korea were expanded after the secretive communist state launched a rocket in December, in a move condemned by the UN as a banned test of missile technology.
North Korea’s latest nuclear test comes as senators in Washington prepare for the first votes on whether to confirm Chuck Hagel as successor to current Defence Secretary Leon Panetta.
In a farewell speech at the Pentagon, Mr Panetta said the US would continue to be tested by unpredictable regimes in years to come.
“We’re going to have to deal with weapons of mass destruction and the proliferation. We’re going to have to continue with rogue states like Iran and North Korea.
“We just saw what North Korea’s done in these last few weeks – a missile test and now a nuclear test. They represent a serious threat to the United States of America. We’ve got to be prepared to deal with that.”
US President Barack Obama, who is to make his State of the Union speech later, called the test a “highly provocative act” and called for “swift” and “credible” international action in response.
China, North Korea’s main ally and a veto-wielding member of the Security Council, summoned North Korea’s ambassador to Beijing to express its concern
Foreign Minister Yang Jiechi delivered a “stern representation”‘ to Ji Jae Ryong and expressed China’s “strong dissatisfaction and firm opposition” to the test, the Chinese foreign ministry said in a statement.
Earlier, it urged the North to honour its commitment to denuclearisation and “not take any actions which might worsen the situation”.
The test was condemned by North Korea’s immediate neighbours, South Korea and Japan, while Russian Foreign Minister Sergei Lavrov called for a revival of talks on the North’s nuclear arms programme.
In a defiant message to the UN’s disarmament forum, the North said it would never bow to resolutions on its nuclear programme and blamed the failure of diplomacy on the US.
“The US and their followers are sadly mistaken if they miscalculate the DPRK [North Korea] would respect the entirely unreasonable resolutions against it,” the North’s envoy, Jon Yong Ryong, told the Conference on Disarmament in Geneva.
North Korea confirmed the test after international monitors recorded seismic activity consistent with a powerful underground explosion at 11:57 (02:57 GMT) on Tuesday.
Activity had been observed at the Punggye-ri nuclear test site for several months.
State-run KCNA news agency said the test was “carried out at a high level in a safe and perfect manner using a miniaturised and lighter nuclear device with greater explosive force than previously”.
North Korea said the nuclear test was a response to the “reckless hostility of the United States”.
“The latest nuclear test was only the first action, with which we exercised as much self-restraint as possible,” the foreign ministry said in a statement.
“If the US further complicates the situation with continued hostility, we will be left with no choice but to take even stronger second or third rounds of action.”
The Vienna-based Comprehensive Nuclear-Test-Ban Treaty Organisation said the “explosion-like event” was twice as big as the 2009 test, which was in turn bigger than that in 2006.
t is the first such test under new leader Kim Jong-un, who took over the leadership after his father Kim Jong-il died in December 2011.
The BBC’s Lucy Williamson, in Seoul, says the trouble, as ever, is what the international community can do in response without triggering an even bigger crisis – North Korea is already tied up in layers of sanctions which do not seem to have any impact.
She adds that some in Washington have talked of maybe targeting North Korean financial interests, but the only real pressure is seen to lie with China.
By defying the UN and launching its nuclear test now, our correspondent says, Pyongyang is giving the new leadership in Beijing a very public test of its own.
Reprinted from BBCnews