* Gold initial run to test $1,000 fails after oil sell-off
* Safe haven buying, weak dollar underpin gold market
* Oil plunge helps equities shrug off Bernanke comments (Recasts, updates with quotes, closing prices, market activity, adds NEW YORK to dateline)
By Jan Harvey and Frank Tang
LONDON/NEW YORK, July 15 (Reuters) - Gold ended higher on Tuesday, erasing gains as oil prices plummeted and an initial bullion rally to test $1,000 an ounce failed.
Spot gold <XAU=> was at $975.90/977.90 by New York's last quote at 2:15 p.m. EDT (1815 GMT), against $971.20/972.20 late in New York on Monday, but remained well off the four-month high of $987.75 an ounce it hit earlier in the session.
"Oil took a tumble, (and) gold was tracking oil as usual," said one trader at a European bank.
U.S. crude futures <CLc1> dropped as much as $9 a barrel in midmorning trade. It ended down $6.44 at $138.74 a barrel.
However, the precious metal remains underpinned by weakness in the dollar and concern over the outlook for the U.S. financial system, which has sparked a wave of safe-haven buying from investors.
Gold climbed earlier in the session as comments from Federal Reserve Chairman Ben Bernanke weighed on the dollar and triggered a drop in U.S. equity markets, fueling safe-haven buying of the metal.
U.S. stocks slid as much as 2 percent and the dollar wilted after Bernanke said high oil prices, a weaker housing market and tighter credit conditions threaten the economy. [ID:nN15297353
"The problems on the equity markets, uncertainty, and general risk aversion are all bullish for gold at the moment," said Lehman Brothers analyst Michael Widmer.
Bernanke said U.S. financial markets and institutions remain under "considerable stress," and added that restoring financial market stability is a top priority for the Fed.
Bill O'Neill, managing partner of LOGIC Advisors in Upper Saddle River, New Jersey, said that gold should continue to benefit from demand as a safe-haven investment as financial market jitters and creeping inflation would take a long time to correct.
Turmoil in the markets has benefited gold, which is often seen as a safe haven from risk that can be bought as an alternative investment to more volatile assets such as stocks.
The U.S. gold contract for August delivery <GCQ8> settled up $5.00 at $978.70 an ounce on the COMEX division of New York Mercantile Exchange.
However, the slide in oil prices helped equities pare losses.
Weakness in the dollar, which struck a record low against the euro on Tuesday, is underpinning the precious metal. Gold typically moves in the opposite direction to the dollar, as it is bought as a currency hedge.
Gold has risen sharply in other currencies as well as the U.S. dollar, reinforcing gold's appeal as a safe haven.
In euro terms it hit a high of 617.92 euros an ounce after Bernanke's comments, its highest since March 18.
Among other precious metals, silver <XAG=> was trading at $18.86/18.94 an ounce from $19.12/19.18 late in New York on Monday. Earlier in the session it also reached a new four-month high of $19.45 an ounce, tracking gold.
Conversely, platinum group metals were weaker. Platinum <XPT=> fell more than 2 percent to a session low of $1,964.50 an ounce, and was last at $1,971.00/1,991.00 an ounce from its previous U.S. finish $2,012.00/2,032.00.
The metal is suffering from expectations of lower demand from carmakers as the U.S. economy fades. Platinum is a major component in autocatalysts.
"(Concern over demand) has been the prevalent theme for a few weeks now," said Daniel Hynes, an analyst at Merrill Lynch. "We've seen any rallies immediately sold off ... and we're seeing a continuation of that today.
"There are also some technical issues as the open interest is quite long in TOCOM in Japan," he added. "The view is that that is pushed to the max, and consequently signs of weakness are resulting in some long liquidation as well."
However, in the long term the metal remains well supported, with buying interest typically returning to the market below $2,000 an ounce, he added.
Palladium <XPD=> dipped to $440.00/448.00 against $448.50/456.50 an ounce late in New York. (Editing by Christian Wiessner)