(Recasts with U.S. markets, adds byline; dateline previous LONDON)
By Herbert Lash
NEW YORK, Feb 27 (Reuters) - U.S. stocks rallied for a fourth day on Wednesday after the federal government moved to free up billions of dollars to invest in the slumping U.S. housing market, sparking a broad advance in financial shares.
The plunging U.S. dollar set a new low against the euro, triggering a surge across commodities markets that are viewed as safe havens. Gold shot to a record near $1,000 an ounce and oil climbed to a record $102.08 a barrel.
The euro jumped past $1.50 for the first time after Federal Reserve Chairman Ben Bernanke signaled that the U.S. central bank will continue to cut interest rates despite stubborn inflation.
European shares ended lower on worries about the U.S. economy and as Britain's biggest mortgage lender, HBOS, warned that financial and housing markets would remain difficult. But losses were limited after the U.S. government said it would lift investment caps for the country's top two home financing companies.
U.S. government bond prices erased gains on the news the that the investment caps for Fannie Mae and Freddie Mac, the two largest providers of finance for U.S. home loans, will be lifted on March 1.
Shares of Fannie Mae <FNM.N> and Freddie Mac <FRE.N>, which are government sponsored, soared after the Office of Federal Enterprise Oversight, their federal regulator, moved to ease investments in the battered U.S. housing market.
"That's driving up the financials," said Giri Cherukuri, head trader at OakBrook Investments LLC, in Lisle, Illinois. "The market seems to be keyed on news that financial companies are in better shape, that things are turning around in the financial sector."
While investors cheered the move, the companies still must hold strong reserves against possible losses, which will limit any attempts to expand mortgage holdings in the short term.
The Dow Jones industrial average <
> was up 55.69 points, or 0.44 percent, at 12,740.61. The Standard & Poor's 500 Index <.SPX> was up 5.21 points, or 0.38 percent, at 1,386.50. The Nasdaq Composite Index < > was up 15.26 points, or 0.65 percent, at 2,360.25.The S&P Financial index rose 1.05 percent.
FANNIE, FREDDIE SHARES RISE
Shares of Fannie Mae, the largest U.S. home financing company, surged as much as 17 percent, and shares of Freddie Mac climbed as much as 16.6 percent, before both pared gains to the low single-digit percentages.
Before markets opened, Fannie reported a $3.6 billion fourth-quarter loss and said it expects a "significant" worsening of the housing bust, which pushed its shares to 12-year lows.
Fannie said it will suffer bigger losses on home loans than it forecast just three months ago as the decline in house prices accelerates and sparks more foreclosures.
In Europe, shares ended down as HBOS <HBOS.L> led banking stocks lower.
The pan-European FTSEurofirst 300 <
> ended 0.22 percent lower at 1,358.21 points.HBOS slid 6.8 percent after it said higher funding costs hit its margins last year and that both financial and housing margins would stay tough.
Japan's Nikkei average rose to a six-week closing high, with blue-chip shares such as Sony Corp <6758.T> driving gains after a $15 billion share buyback plan announced on Tuesday by IBM <IBM.N> boosted investor confidence.
Hong Kong blue chips hit three-week highs.
The Nikkei average <
> rose 1.5 percent to 14,031.30, the highest close since Jan. 11, while the benchmark Hang Seng Index < > in Hong Kong ended up 3.2 percent at 24,483.84.U.S. oil earlier rallied to a record of $102.08 a barrel, near its inflation-adjusted lifetime peak of $102.53.
But U.S. government data showing substantial builds in crude oil and gasoline inventories again raised concerns about the economy of United States, the world's biggest oil consumer, and with it the prospects of future oil demand.
U.S. crude oil <CLc1> was down 29 cents at $100.59.
The dollar slumped to an all-time low versus a basket of currencies on expectations the Federal Reserve will cut interest rates aggressively, making U.S. assets less attractive.
Bernanke, in testimony to the U.S. Congress, said the U.S. central bank will act to ensure beleaguered housing and credit markets do not further undermine an already sluggish economy.
"I am convinced they are prepared to ride through inflation well above their target for the rest of the year at the minimum. They are going to cut rates as need be to support economic growth," said Brian Dolan, chief FX strategist at Forex.com in Bedminster, New Jersey.
The euro/dollar <EUR=> was up 1.1 percent midway through the New York session at $1.5133. The euro had climbed as high as $1.5143, according to Reuters data, the first time it has climbed above $1.51 in its nine-year history. The dollar index fell to a record low of 74.070 <.DXY> .
Spot gold <XAU=> rose as high as $964.70 an ounce as investors piled in, spurred by a plummeting dollar and oil rising above $100 a barrel.
Silver rallied to its loftiest level since November 1980, palladium jumped to a 6-1/2-year high and platinum advanced to trade near last week's record highs before paring gains. (Additional reporting by Chris Reese, Nick Olivari, Ellis Mnyandu and Caroline Valetkevitch in New York, and Santosh Menon and Atul Prakash in London; editing by Leslie Adler)