Stocks rose on Thursday as better-than-expected earnings by Wal-Mart Stores Inc helped offset disappointing government numbers on retail sales and jobs.

Shares of Wal-Mart, the world's largest retailer, gained 2.7 percent to $51.88 following its second-quarter earnings and its outlook for the full year.

The rest of the retail sector was lukewarm, however, after the U.S. Commerce Department reported retail sales fell 0.1 percent in July, defying market expectations of a gain. Analysts had expected a boost to retail sales from the government's cash for clunkers program that offers taxpayers money for trading in gas guzzlers for more fuel efficient new cars.

The S&P retail index added 0.3 percent.

Also on the negative side, the government said the number of workers filing initial applications for unemployment benefits rose by 4,000 to a seasonally adjusted 558,000. Economists had anticipated a drop.

What really helped us this morning was Wal-Mart coming out and kind of across the board saying early back-too-school numbers were pretty good, said Warren Simpson, managing director at Stephens Capital Management in Little Rock, Arkansas.

That kind of keyed the market, at least having some resiliency and some support, and consequently, we've rallied just a little here.

The market had surged on Wednesday after the Federal Reserve said the economy appears to be leveling out. But Thursday's data served as a reminder that the economic picture remains unsettled.

To be up after a day like we had yesterday is a pretty good day, Simpson added.

The Dow Jones industrial average <.DJI> rose 36.58 points, or 0.39 percent, to 9,398.19. The Standard & Poor's 500 Index <.SPX> gained 6.92 points, or 0.69 percent, to 1,012.73. The Nasdaq Composite Index <.IXIC> added 10.63 points, or 0.53 percent, to 2,009.35.

Financial stocks were among the bright spots, a day after hedge fund manager John Paulson -- who had made a fortune betting against financial companies after foreseeing the credit crisis -- disclosed that he had bought large stakes in several banks, including Bank of America.

Bank of America shares gained 6.7 percent to $17.00, and the KBW Bank index <.BKX> gained 3.1 percent.

After the closing bell, shares of Nordstrom Inc slipped 0.9 percent to $29.50 after the upscale department store operator reported a steep decline in quarterly profit, that nonetheless met expectations.

Shares of AutoDesk Inc added 0.8 percent after the bell after the software designer posted forecast-beating quarterly results.

Stocks briefly extended gains at midday after a 30-year U.S. Treasury bond auction was well received, providing a boost to confidence in U.S. assets including stocks.

Homebuilder shares fell on a string of downgrades, with D.R. Horton Inc down 3.7 percent to $12.95 after Citigroup cut its rating. KB Home fell 2.5 percent to $17.83 after a downgrade by Raymond James.

The Dow Jones U.S. Home Construction index <.DJUSHB> shed 1.5 percent.

Volume was light on the New York Stock Exchange, with 777 million shares changing hands, well below last year's estimated daily average of 1.49 billion, while on the Nasdaq, about 1.01 billion shares traded, below last year's daily average of 2.28 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of 1,999 to 1,036, while advancing stocks beat decliners on the Nasdaq, by 1,462 to 1,197.

(Editing by Leslie Adler)