* U.S., European stocks gain on signs money markets thaw
* S&P posts worst monthly loss since 1987, Dow since 1998
* Dollar is broadly firmer; risk aversion boosts yen
* Oil rises above $67 in late surge on short-covering
* Many financial markets mark record misery in October (Adds close of U.S. markets)
By Herbert Lash
NEW YORK, Oct 31 (Reuters) - U.S. stocks rose on Friday, closing out one of their worst months on record, on hopes that a thawing in credit markets will spur growth even as most commodity prices slumped again on growing evidence of a deepening recession.
Gold, oil and other commodities posted record declines during October, a month racked by wild price swings across all financial markets as investors sought shelter from a downturn that looms as the most severe since the Great Depression.
The U.S. dollar and yen posted sharp gains on Friday as investors reined in risky bets even after the Bank of Japan joined other central banks in cutting interest rates.
The euro <EUR=> fell more than 1 percent versus the dollar and yen, capping its worst monthly performance versus the dollar since the single European currency's inception in 1999.
Equities on both sides of the Atlantic shrugged off renewed signs of a deep slowdown. U.S. consumers in September cut spending for the first time in two years and their mood soured further in October as they braced for tough times ahead.
The interbank cost of borrowing dollars, sterling and euros again eased in overnight markets, lending support to equities, while stock buying by mutual funds to rebalance portfolios at the end of their fiscal year also helped, traders said.
The interbank cost of borrowing dollars fell across the board, with the overnight dollar rate falling to 0.40 percent from 0.73 percent, well below the U.S. Federal Reserve's benchmark federal funds rate of 1 percent.
Financial shares, led by a more than 8 percent gain in JPMorgan Chase <JPM.N>, lifted Wall Street as the interbank borrowing cost eased.
"One of the big stories this week is October ended, and specifically the fiscal year for institutional mutual funds and pension funds came to an end," said Bruce Zaro, chief technical strategist at Delta Global Advisors in Boston.
"I think that relieved a lot of the selling pressure and you've seen some window dressing," Zaro said.
The Dow Jones industrial average <
> closed up 144.00 points, or 1.57 percent, at 9,324.69. The Standard & Poor's 500 Index <.SPX> added 14.66 points, or 1.54 percent, at 968.75. The Nasdaq Composite Index < > rose 22.43 points, or 1.32 percent, at 1,720.95.For the week the Dow rose 11.3 percent, the S&P gained 10.5 percent and the Nasdaq added 10.9 percent.
The Dow posted its worst monthly percentage loss since August 1998; the S&P its worst since October 1987, and for Nasdaq the worst since February 2001.
European shares extended a rally to a fourth day, boosted by oil and drug companies and a late surge in bank shares.
The FTSEurofirst 300 <
> index of leading European companies closed 2.8 percent higher at 928.81. For the month, it fell 12.7 percent, its worst fall since September 2002.Among drugmakers, Roche <ROG.VX> jumped 9.6 percent and Novartis <NOVN.VX> added 5 percent, while oil stocks bounced from Thursday's losses and banks rallied. Anglo Irish <ANGL.I> rose 21.4 percent on bargain hunting after recent weakness.
"The general consensus is that it's a dead cat bounce. But it's too early to say. There's a lot of positive signals coming from any kind of valuation-based approach," said Gareth Williams, European equity strategist at ING.
Commodity prices were pressured by the stronger dollar and recession fears.
U.S. gold futures ended nearly 3 percent lower as bullion concluded its worst month in a quarter century.
The December gold contract <GCZ8> settled down $20.30 at $718.20 in New York.
Oil rose almost 3 percent at day's end, reversing an earlier fall, as investors rushed to close positions that had bet on price declines.
U.S. crude <CLc1> settled up $1.85 at $67.81 a barrel. For the month, oil fell more than 32 percent -- its steepest monthly decline ever -- as demand continues to slow in the United States and other big consumer nations.
London Brent crude <LCOc1> settled up $1.61 at $65.32.
U.S. Treasury prices trimmed gains at day's end after the dour economic news kept a flight to safety bid alive.
The benchmark 10-year U.S. Treasury note <US10YT=RR> was little changed in price to yield 3.97 percent, while the 2-year U.S. Treasury note <US2YT=RR> also was little changed to yield 1.56 percent.
The scope of Thursday's economic data reminded investors that the outlook is not particularly appealing, said Sebastien Galy, a currency strategist at BNP Paribas in New York.
"So it's the usual theme we're seeing today," Galy said. "Whenever the data is poor, we see the dollar strengthening relative to the euro and commodity currencies. We are still in a very elevated level of risk aversion."
The dollar rose against a basket of major currencies, with the U.S. Dollar Index <.DXY> up 1.12 percent at 85.747. Against the yen, the dollar <JPY=> fell 0.11 percent at 98.50.
The euro <EUR=> fell 1.20 percent at $1.2751.
Tokyo's Nikkei average <
> extended losses to close down 5 percent after the Bank of Japan cut interest rates to 0.3 percent, its first rate cut in seven years. (Reporting by Leah Schnurr, Gertrude Chavez-Dreyfuss, John Parry and Frank Tang in New York and Brian Gorman, Edward McAllister, Ian Chua and Julie Crust in London; writing by Herbert Lash; Editing by Leslie Adler)