By Jan Harvey and Peter Hobson
LONDON (Reuters) - Gold dipped on Wednesday, erasing earlier slim gains as the dollar index moved into positive territory, though a retreat in global stocks after Tuesday's record high kept the metal hemmed within a narrow range.
Spot gold was down 0.4 percent at $1,326.07 an ounce at 1410 GMT, off an earlier peak of $1,334.65.
The metal's move lower came as the dollar erased earlier losses to rise 0.4 percent versus a basket of currencies. A firmer dollar makes gold more expensive for holders of other currencies.
"This seems to be currency led," Saxo Bank's head of commodity research Ole Hansen said.
"I'm somewhat surprised that gold managed to find support ahead of $1,321.50, the 23.6 percent retracement of the July to September rally, but with (North Korean leader) Kim vowing to keep pushing his nuclear ambitions, the geo-risk is never far away."
Demand for gold, seen as a safe investment in uncertain times, revived earlier after U.S. President Donald Trump pledged stronger measures against North Korea and Pyongyang promised to fight off what it said was the threat of a U.S. invasion.
Concerns over North Korea's nuclear ambitions were a key factor driving spot gold prices to 13-month highs last week at $1,357.54 an ounce. A softening in those worries helped lift equities to record highs early this week.
U.S. gold futures for December delivery were down $2.90 an ounce at $1,329.80.
Investors are now looking ahead to U.S. consumer inflation data on Thursday, which should give further clues about the pace of U.S. interest rate rises. A run of weak inflation readings has lowered expectations the Federal Reserve will raise rates in December.
Investors have also been taking advantage of a fall in prices from last Friday's 13-month high, Robin Bhar, head of metals analysis at Societe Generale, said.
"Geopolitical trouble hasn't disappeared and the U.S. political landscape is still fraught with difficulties," he said. "When gold drops almost $40, a lot of investors see that as a good level at which to buy back in."
Investors in gold-backed exchange-traded funds (ETFs) were buying as prices fell. Holdings of the largest gold-backed ETF, New York's SPDR Gold Trust, rose 0.35 percent on Tuesday from Monday.
Among other precious metals, silver was flat at $17.90 an ounce. The metal reached its highest since early April on Friday at $18.208 an ounce.
Platinum was 0.1 percent lower at $985.90 an ounce and palladium was down 0.8 percent at $947.25.
(Additional reporting by Apeksha Nair in Bengaluru; Editing by David Clarke and Mark Potter)