NEW YORK (MarketWatch) -- U.S. stocks ended higher Friday, leaving the market with monthly losses but with large gains for a holiday-shortened week that saw investors increasingly confident that much of a dire economic outlook already has been priced in.

The market gained on so-called Black Friday, marking its fifth-straight session of gains, with grim prospects for retailers failing to dent optimism at the traditional start of the U.S. holiday-shopping season.

"With the market [having its] fifth day of gains in a row, there's a bit of confidence returning," said Peter Cardillo, market economist at Avalon Partners. "This market has discounted a lot of negative news."

The Dow Jones Industrial Average DJIA, -0.47% gained 102 points, or 1.2%, to 8,829, with 23 of its 30 components ending higher. While the blue-chip average fell 5.3% for the month of November, it jumped 9.2% over the past week.

"Even though it was abbreviated, this is one of the biggest gaining weeks in a long, long time," Cardillo added. With the market falling so far and so quickly over the past few months, "the picture has gotten technically strong here, which is another reason investors are coming in."

Even more impressive, the Dow gained 1,277 points, or 17%, in just five sessions, marking its best five-day percentage gain since 1932, and its best five-day point gain on record.

Among Dow components, shares of Citigroup Inc. C, -2.12% jumped 17.6%, continuing this week's advance after the government announced it would bail out the ailing bank.

General Motors Corp. GM, -2.37% gained 9% after Bloomberg News reported the automaker is studying whether to cut its Saab, Saturn and Pontiac brands. The move could be part of the company's pitch to the U.S. government for funds from a potential $25 billion loan package for the U.S. auto industry.

But at the kickoff of the holiday shopping seasons, shares of Wal-Mart Stores Inc. WMT, -0.08% , the world's biggest retailer, slipped 1.4%.

Exxon Mobil Corp. XOM, -2.91% and Chevron Corp. CVX, -2.74% both fell 1%. Crude futures came under early pressure, but finished little changed, amid talk that the Organization of the Petroleum Exporting Countries may delay production cuts to December. See Futures Movers.

The S&P 500 Index SPX, -0.48% rose 8 points, or 1%, to 896 Friday. The broad index fell 7.4% in November, but it surged 12% for the week.

Friday's gains were led by the financial sector, which rose 2.2%. The U.K. government said it will own 57.9% of Royal Bank of Scotland RBS, -2.42% , after investors took up only 0.24% of the shares of the bank on offer.

The Nasdaq Composite Index COMP, -0.29% gained 3 points, or 0.2%, to 1,535. The technology-heavy index jumped 11% for the week and had a monthly loss of 10.8%.

Trading volumes were very thin, with 787 million shares changing hands on the New York Stock Exchange and 324 million shares trading on the Nasdaq market. Gaining issues topped decliners by 2 to 1 on both the Big Board and the Nasdaq.

Traders were watching for early clues to the holiday-season performance, which is expected to have the worst season in years after posting the weakest October results on record, as shoppers keep a tight grip on their wallets due to the worsening economy. See full story.

"[Friday] marks the start of the holiday-shopping season in the United States, although given the dismal environment, many retailers had started their promotions early," said Doug Porter, an economist at BMO Capital Markets.

Among key electronic retailers, shares of Best Buy Co. BBY, +1.51% fell 1.8%, while those of Circuit City CCTYQ, which has filed for bankruptcy, were flat.

Shares of department-store operator Dillard's Inc. DDS, +7.61% fell 2.4%. On Wednesday, it cited the "oppressive economic environment" and posted a widening loss.

Also on Wednesday, luxury retailer Tiffany & Co. TIF, -0.22% slashed its full-year outlook, announced job cuts and reduced capital spending in anticipation of soft holiday sales. The stock fell 5%.

U.S. markets were closed Thursday for Thanksgiving. On Wednesday, stocks rose as investors focused on dealmaking in the technology sector and shrugged off gloomy economic data and downcast corporate earnings reports. Read Snapshot.

In Tokyo, the Nikkei 225 gained 1.7%. In London, the FTSE 100 rose 0.6%. See Asia Markets.Read Europe Markets.