Gold hit a near two-month peak on Wednesday, after North Korea said it is considering an attack on the U.S. Pacific territory of Guam and U.S. president Donald Trump boasted of the strength of the American nuclear arsenal.
The tensions rattled through global markets, sending investors out of equities and into the safety of the yen, Swiss franc, and government debt. The VIX "fear gauge" of expected volatility on the S&P 500 hit a one-month high .
"The market hates uncertainty and that's certainly what we have now," said Ole Hansen, head of commodity strategy at Saxo Bank.
"But looking ahead unless we start to see a conflict breakout or a major stock market correction, (gold) is capped at 1,295 (although) the upside at moment is the favored direction."
Spot gold rose 1.31 percent to $1,276.80 per ounce, while U.S. gold futures for December delivery rose settled up at $1279.30 per ounce. Gold futures had its best daily performance since May 17, when it gained 1.8 percent.
Gold hit a two-week low on Tuesday after U.S. jobs data came in better than expected and the dollar turned positive, while investors awaited U.S. inflation figures later this week for further clues about the pace of interest rate rises.
A strong dollar makes dollar-priced gold costlier for non-U.S. investors while rising interest rates increase the opportunity cost of holding non-yielding bullion.
"We've had some competing forces play out over the past 12 hours -- the U.S. dollar was stronger off economic data, but that was quickly reversed with President Trump's comments about North Korea," ANZ analyst Daniel Hynes said.
"I think (the North Korea situation) is going to continue to provide a little bit of support, but not enough to push prices significantly higher from here," he added.
The dollar rose versus a basket of currencies Wednesday but was down 1 percent against the Swiss franc, a traditional safe haven.
"We believe continued saber-rattling ... could take gold prices higher still," said Nitesh Shah, director at ETF Securities. "There is genuine concern, hence the fall in the dollar, (but) as ever with Trump, its unclear how quickly the rest of the U.S. machinery will calm him, so rises are not yet huge.