"We will not stand idly by as North Korea builds the capability to wreak destruction on any target in the region -- or on us," Gates told an annual international meeting of defense and security officials from Asia and the Pacific Rim.
Gates called North Korea's nuclear program a "harbinger of a dark future" but said he does not consider it a direct military threat to the United States "at this point."
He also compared North Korea's nuclear program to Iran's, but noted that North Korea's program is farther along. Gates called for "genuinely tough sanctions" against both countries "that bring home real pain for their failure to adhere to international norms."
Gates offered no specifics on how the U.S. might respond to North Korea, militarily or otherwise, and has said there are no current plans to deploy more U.S. forces to the region.
At the conference, concern over the nuclear threat served to unify the region's sometimes diplomatic adversaries.
Chinese Lt. Gen. Ma Xiaotian said Beijing is "resolutely opposed to nuclear proliferation" and called for nations to "remain cool-headed and take measure to address the problem." South Korean Defense Minister Lee Sang Hee called the tests "a serious challenge to the nuclear nonproliferation treaty and has made a solution of the North Korean nuclear problem more difficult."
Gates' speech delivered his harshest words to date to North Korea since Pyongyang detonated an underground nuclear device Monday, followed by several short-range missile launches over the last few days.
The Pentagon chief focused most of his comments on U.S. priorities like high-seas piracy and the war in Afghanistan. Despite his warning, he appeared to take care in the half-hour speech to avoid ratcheting up the rhetoric in the weeklong war of words between North Korea and nations alarmed by its show of weaponry.
The U.N. Security Council is considering tough sanctions to punish North Korea for its nuclear test. In turn, North Korean leaders said they would respond in "self-defense" to the as-of-yet unspecified sanctions but did not say how.
Western security experts suggest that Washington's best strategy may be to resist getting egged into action by North Korea's talk.
"North Korea is talking war but planning how to best avoid it while maintaining the maximum international turmoil," David Fulghum, senior military editor of Aviation Week, said in a statement. "The rationale, believe U.S. analysts and military officials, is that constant provocation of the West is the only road to relevance."
Gates' also spoke broadly about bolstering diplomatic relations with China and cited common challenges the two sometimes-adversaries face: counterterrorism, piracy, energy security and disaster relief. "It is essential for the United States and China to find opportunities to cooperate wherever possible," he said.
He praised South Korea and Japan for becoming "economic powerhouses" that need little U.S. military assistance. Gates was to meet later Saturday with the two nations' top defense officials in talks likely to focus on North Korea.
And Gates urged nations to remain involved in the war in Afghanistan, saying that extremists nestled in the rocky Afghanistan-Pakistan border are probably to blame for much of the terror threats throughout the rest of Asia.
"I know some in Asia have concluded that Afghanistan does not represent a strategic threat for their countries," he said. "But the threat from failed or failing states is international in scope. ... Failure in a place like Afghanistan would have international reverberations -- and, undoubtedly, many of them would be felt in this part of the world."
In talking about the Obama administration's commitment to the region, Gates appeared to voice a veiled general apology for previous U.S. military decisions, but he avoided detailing them.
"In our efforts to protect our own freedom -- and that of others -- we have from time to time made mistakes, including at times being arrogant in dealing with others," he said. "But we always correct course. Our willingness to do so is one of our enduring strengths."