Gold futures closed with gains for the first time this week on speculation that higher energy costs and a weaker dollar will boost demand for the precious metal as a hedge against inflation.

Gold for June delivery surged $13.50 to close at $880 an ounce on the New York Mercantile Exchange. It hit an intraday high of $888. The price of the precious metal fell $3.10 on Wednesday.

The contract lost $19.30, or 2.2 percent, between May 9 and Wednesday. Gold is still down 15 percent from a record $1,033.90 an ounce on March 17, when oil and the euro set previous highs.

The dollar was little changed against a weighted basket of the euro, yen, pound and three other major currencies.

The dollar lost as much as 0.5 percent after a Federal Reserve report said manufacturing in New York unexpectedly dropped this month.

The dollar index, which tracks the greenback against a basket of other major currencies, rose 0.1 percent to 73.40.

Crude-oil prices rose as much as 2 percent before erasing gains. Oil reached a record $126.98 a barrel on May 13.

Also on the Nymex Thursday, July silver rose 7 cents to finish at $16.68 an ounce and July platinum surged $37.80 to end at $2,076.90 an ounce.

June palladium futures closed at $440.60 an ounce, up $2.90. July copper futures rose 6 cents to end at $3.74 a pound.