Bernanke outlined several options Wednesday, including another bond-buying program designed to keep interest rates low. Bernanke said the Fed would only take such actions if economic weakness persists and if the threat of deflation, or falling prices, emerges again.

Bernanke's comments caused the dollar to weaken. That benefited commodities, which are priced in dollars. A weaker dollar makes them less expensive for buyers who use other currencies.

The Fed announced its last bond-buying program in August. That $600 billion program was implemented in November and ended June 30.

"He's giving the market a very much needed shot in the arm," Kingsview Financial analyst Matt Zeman said. "Markets like to overshoot so you're seeing a big reaction. I expect we'll see things settle down in the coming days."

Other factors also influenced commodities, including robust economic growth in China, lingering worries about Europe's financial problems and negotiations on the U.S. government's debt limit.

Gold for August delivery gained $23.20 to settle at $1,585.50 an ounce after hitting $1,589 an ounce earlier in the day. The settlement price was a record in dollar terms but below its peak in the early 1980s after accounting for inflation.

September silver rose $2.517 to settle at $38.151 an ounce, September copper gained 1.2 cents to $4.4035 a pound, October platinum increased $30.70 to $1,767 an ounce and September palladium rose $16.55 to $784 an ounce.

In other trading, wheat for September delivery jumped 42.5 cents to settle at $7.145 a bushel, December corn gained 21.75 cents to $6.7975 a bushel and November soybeans rose 21.5 cents to $13.7975 a bushel.

Benchmark crude for August delivery gained 62 cents to settle at $98.05 a barrel on the New York Mercantile Exchange after hitting $99.21 a barrel in earlier trading.