(Updates to mid-afternoon, changes byline)
By Justin Grant
NEW YORK, March 20 (Reuters) - U.S. stocks rose on Thursday as falling gold and oil prices calmed inflation fears, while major mortgage financiers Fannie Mae and Freddie Mac surged for a third day on hopes they will stabilize the housing market.
Fears about rising inflation cooled as commodity prices fell across the board. Metal and oil investors retreated into cash, taking profits after a series of record peaks this year.
Prior to this week, investors had piled into gold, which emerged as a safe-haven after U.S. stocks slumped due to recession fears and the global credit crisis, sending the price of the metal briefly above $1,000 an ounce for the first time.
The Dow Jones industrial average <
> climbed 166.97 points, or 1.38 percent, at 12,266.63. The Standard & Poor's 500 Index <.SPX> gained 17.79 points, or 1.37 percent, to 1,316.21. The Nasdaq Composite Index < > was up 26.76 points, or 1.21 percent, at 2,236.72.Fannie Mae <FNM.N> and Freddie Mac <FRE.N> soared after Keefe, Bruyette & Woods upgraded them, saying a decision by federal regulators to immediately reduce the amount of excess capital they need to hold should let the government-sponsored enterprises support liquidity in the mortgage market.
"Value investors are starting to see the Fed ... has successfully made the statement that whatever disaster might pop up, they're stepping in to liquefy the situation," said Michael Williams, chief investment strategist at Tocqueville Asset Management in New York. "This inflation-hawk kind of talk has been way overdone. The little guy panicked out of stocks."
On Tuesday, the S&P 500 made its biggest one-day jump in more than five years after the Federal Reserve cut short-term U.S. interest rates by three quarters of a percentage point. Earlier it launched a lending facility that allows investment banks to borrow money directly from the U.S. central bank.
Freddie Mac was trading up 8.8 percent to $32.52, while Fannie Mae was up 11.5 percent to $34.25.
The S&P's index of financial shares <.GSPF> surged 4.5 percent.
Adding to the positive sentiment, Merrill Lynch & Co upgraded economic bellwether General Electric Co <GE.N>, saying the conglomerate's defensive positioning at a time when the economy is slowing will lead the stock to outperform. GE shares rose 5.1 percent to $37.42.
Crude oil <CLc1>, which sagged below $99 earlier, was down $1.90 to $100.64 a barrel, alleviating worries about the effect of high prices on consumers and businesses. Shares of retailer Wal-Mart Stores Inc <WMT.N> rose 4.4 percent to $53.03.
Stocks had rallied early in the day after a survey from the Philadelphia Federal Reserve Bank showed factory activity in the U.S. Mid-Atlantic region shrinking for the fourth consecutive month in March, but by slightly less than the median forecast. For more see [
].Helping the Nasdaq were shares of Intel Corp <INTC.O>, up 2.9 percent to $21.69 after the chip maker raised its quarterly dividend by about 10 percent.
Shares of Nike Inc <NKE.N> jumped 6.3 percent to $65.75 as the company posted a third-quarter profit that handily beat estimates. [
].Markets will be closed for Good Friday and the U.S. bond market closed early on Thursday. (Editing by James Dalgleish)