Wall Street stocks rose on Thursday on the latest signs of an improving U.S. economy and optimism a Greek bailout deal would be agreed next week.

Equity indexes continued to trade in tight ranges, with the S&P 500 near a nine-month high.

U.S. labor, manufacturing and housing data suggested sustained momentum in the key economic sectors and confirmed the recovery continues at steady pace.

We're getting this incredible flow of good data, said Jim Paulsen, chief investment officer at Wells Capital Management in Minneapolis. It's hard not to want to step into the market.

The euro zone is putting the finishing touches to a second bailout deal for Athens that could be approved on Monday, officials said, moving closer to averting a disorderly default by Greece.

People are increasingly of the opinion that although Europe will continue to have flare-ups, it's not likely to become a calamity for the world economy,' Paulsen said.

The Dow Jones industrial average <.DJI> added 109.13 points, or 0.85 percent, to 12,890.08. The S&P 500 Index <.INX> gained 10.52 points, or 0.78 percent, to 1,353.75. The Nasdaq Composite <.IXIC> rose 26.00 points, or 0.89 percent, to 2,941.83.

Bank shares rose, brushing off a warning from Moody's about possible downgrades to the credit ratings of 17 global and 114 European financial institutions.

Among the ratings threatened were those of Goldman Sachs , up 1.2 percent at $114.50, and Bank of America , up 2.8 percent at $8.

The KBW bank index <.BKX> rose 1.7 percent.

Apple shares, which largely dictated the direction of Wednesday's stock market, were off 1.1 percent at $492.24.

Trading in Apple topped 17 million shares at midday, above its 15.4 million average in the last 25 days.

According to a Chinese newspaper website, some cities have asked retailers to take Apple iPad tablets off shelves after a legal battle between a Chinese technology firm and Apple over trademark issues.

(Reporting by Rodrigo Campos; Editing by Kenneth Barry)