Boris Johnson has backed a diplomatic resolution to the North Korean crisis but says the US has an "absolute duty" to prepare "any option" in response to a nuclear threat.
He also urged US President Donald Trump to stick with the Iran nuclear deal.
Pyongyang's nuclear ambitions has stoked tensions in recent months leading to heated rhetoric between Mr Trump and North Korea's leader Kim Jong-un.
In a speech to the Chatham House foreign affairs think tank, Mr Johnson said: "No one wants any kind of military solution to the problem."
But he added that the US has to prepare to act when faced by a man "who not only threatens to reduce New York to 'ashes', but who stands on the verge of acquiring the power to make good on his threat".
Mr Johnson also praised US Secretary of State Rex Tillerson for keeping diplomatic options open with Pyongyang, despite Trump dismissing talk with the regime as a "waste of time".
Mr Johnson also urged Mr Trump not to withdraw the US from the 2015 Iran nuclear deal, arguing that similar “diplomatic imagination” could help resolve the crisis on the Korean Peninsula.
The Foreign Secretary’s intervention comes a week after Trump decertified the landmark agreement claiming it was not in the US national interest.
He also threatened to withdraw from the pact agreed by this predecessor Barack Obama altogether.
The Foreign Secretary said the Iran deal had proved crucial at a time when the country had been "only months away" from producing a nuclear weapon.
Mr Johnson said in the event this had happened it could have triggered an arms race in "one of the most volatile regions of the world".
"Think of the nightmare that deal has avoided," he added.
Mr Johnson acknowledged concerns about Iran's support for Hezbollah, its supply of weapons to Houthi rebels in Yemen and interference in Syria.
"But that does not mean for one minute that we should write Iran off," he said.
"On the contrary, we should continue to work to demonstrate to that population that they will be better off under this deal and the path of re- engagement that it prescribes."
He added that with "determination and courage" the joint comprehensive plan of action (JCPOA) deal could be preserved.