James Mattis' strong warning came just hours after North Korea carried out its sixth nuclear test - the most powerful blast to date.
"Any threat to the United States or its territories, including Guam, or our allies will be met with a massive military response, a response both effective and overwhelming," Mattis said on Sunday.
In his remarks, Mattis said: "Kim Jong-un should take heed of the United Nations Security Council's unified voice. All members unanimously agreed on the threat North Korea poses and remain unanimous in their commitment to the denuclearization of the Korean Peninsula.
"We are not looking to the total annihilation of a country, namely North Korea, but as I said, we have many options to do so."
The official Korean Central News Agency (KCNA) said the hydrogen bomb test on Sunday morning, ordered by leader Kim Jong-un, was a "perfect success".
It was North Korea's first nuclear test since Donald Trump took office, and marked a direct challenge to the US president, who hours earlier talked by phone with Shinzo Abe, Japan's prime minister, about the "escalating" nuclear crisis in the region.
Mattis said he had attended a "small group" national security meeting with Trump and others.
He said Trump wanted to be briefed on each of what Mattis called "many military options" for action against North Korea.
"We made clear that we have the ability to defend ourselves and our allies, South Korea and Japan, from any attacks, and our commitments among the allies are ironclad," Mattis said.
'We will see' about attack
Trump also warned on Sunday that the time for "appeasement" was over and threatened drastic economic sanctions.
When asked if he would attack North Korea, Trump said, "we'll see".
No US military action appeared imminent, and the immediate focus appeared to be on ratcheting up economic penalties, which have had little effect thus far on North Korea's nuclear programmes.
Members of Congress expressed alarm at North Korea's test and emphasised strengthening US missile defences.
Trump also suggested putting more pressure on China in hopes of persuading Beijing to exert more effective leverage on its neighbour.
Trump said on Twitter that the US is considering "stopping all trade with any country doing business with North Korea".
Such a move would have a big impact on China.
The US imports about $40bn in goods a month from China, North Korea's main commercial partner.
Secretary of State Rex Tillerson was calling his counterparts in Asia, and Trump's treasury secretary, Steven Mnuchin, said he was putting together proposed new sanctions for Trump to consider that would seek to cut off trade with North Korea.
It is unclear what kind of penalties might make a difference.
Lassina Zerbo, head of the UN test ban treaty organisation, said sanctions already imposed against North Korea are not working.
China's official Xinhua News Agency said President Xi Jinping and Russian leader Vladimir Putin, meeting on the sidelines of a Beijing-led economic summit, agreed "to adhere to the goal of the denuclearisation of the Korean Peninsula, have close communication and coordination and properly respond" to the test.
The nuclear test also drew strong condemnation from other leaders worldwide.
The UN Security Council plans to hold an emergency meeting on Monday to discuss the international response to the test.
Antonio Guterres, UN secretary-general, condemned North Korea's move as "profoundly destabilising".
Al Jazeera's Mike Hanna, reporting from Washington, DC, said that "at this stage, it does look like everything is going to be left to the Security Council", adding that "it appears the Trump administration is waiting to see what will come out of Monday's meeting before deciding whether to take any unilateral action".
The precise strength of the underground nuclear explosion had yet to be determined.
South Korea's weather agency said the artificial earthquake caused by the explosion was five to six times stronger than tremors generated by North Korea's previous five tests.
North Korea's state-run television broadcast a special bulletin to announce the test, and said Kim attended a meeting of the ruling party's presidium and signed the go-ahead order.
Earlier, the party's newspaper published photos of Kim examining what it said was a nuclear warhead that was to be fitted onto an intercontinental ballistic missile (ICBM).
|Sunday's test was the most powerful nuclear test it has conducted to date [KCNA/Reuters]|
Sunday's detonation builds on recent North Korean advances that include test launches in July of two ICBMs that are believed to be capable of reaching the mainland US.
North Korea says its missile development is part of a defensive effort to build a viable nuclear deterrent that can target US cities.
In response, Trump has warned in the past that he would rain "fire and fury" on North Korea if it continued its threats and programme.
North Korea has previously threatened to fire missiles towards the US territory of Guam.
Source: Al Jazeera and news agencies