Stocks advanced on Tuesday, pushing the S&P 500 to its highest since early August, but sharply pared gains late in the session as Citigroup's steep drop in profit gave investors a reason to unload bank shares.

The financial sector, which has outperformed the broader market so far this year, took a hit on investors' disappointment with Citigroup Inc's earnings.

Citigroup's stock slid 8.1 percent to $28.25 after it reported weaker-than-expected earnings.The KBW Banks Index lost 1.4 percent. Through Friday, the KBW Banks Index was up about 10 percent for the year, while the S&P 500 was about 2 percent higher.

The banks' sell-off splashed cold water on a rally that drove the S&P 500 through 1,300 for the first time since August.

Stocks rallied about 1 percent across the board after data showed China's economic growth was better than expected, even though it expanded at the weakest pace in 2-1/2 years.

The better numbers out of China this morning got the market off to a better start, but then there wasn't much follow-through, and you have had what looked to be from JPMorgan and Citigroup not very good-looking earnings, said Eric Kuby, chief investment officer of North Star Investment Management Corp., in Chicago.

Citigroup's results followed similarly disappointing earnings on Friday from JPMorgan Chase & Co .

The Dow Jones industrial average <.DJI> rose 60.01 points, or 0.48 percent, to 12,482.07 at the close. The Standard & Poor's 500 Index <.SPX> added 4.58 points, or 0.36 percent, to 1,293.67. The Nasdaq Composite Index <.IXIC> gained 17.41 points, or 0.64 percent, to 2,728.08.

After the bell, shares of Yahoo shot up 3.6 percent to $15.99 in extended-hours trading following news that Yahoo co-founder Jerry Yang resigned. [ID:nL1E8CHCYY] In regular trading, Yahoo's stock slipped 0.3 percent to close at $15.43.

Also after the close, shares of Cree , LED lighting maker, fell 5.5 percent to $22.05 in extended-hours trading after reporting a profit that fell short of analysts' estimates and giving a revenue forecast below expectations. Cree's stock had closed on Nasdaq at $23.33, up 1.9 percent.

Bank shares also suffered on Friday ahead of the widely expected announcement by Standard & Poor's that it was downgrading the credit ratings of nine euro-zone countries.

It was expected that some of the big banks would continue struggling, especially those heavily involved in investment banking because that part of the financial system has clearly slowed down, said Bryant Evans, investment advisor and portfolio manager at Cozad Asset Management, in Champaign, Illinois.

While Wells Fargo & Co posted a 20 percent jump in quarterly profit, its stock, which earlier had risen more than 1 percent to a session high at $30.69, pulled back sharply from that peak and ended up just 0.7 percent at $29.81.

The Nasdaq outperformed the other major U.S. stock indexes, with shares of Applied Materials up 2.4 percent at $11.78. RBC upgraded the stock to outperform. An index of semiconductor stocks <.SOX> advanced 0.5 percent.

The benchmark S&P 500 briefly moved above 1,300 on an intraday basis for the first time since August 1. Analysts said a substantial move past that resistance point could trigger more buying.

On the downside, Carnival Corp shares slid 13.7 percent to $29.60 as its Italian unit, Costa Crociere, struggled to locate missing passengers after a cruise liner capsized. Fellow cruise operator Royal Caribbean Cruises Ltd fell 6.2 percent to $26.97.

On the U.S. economic front, a gauge of manufacturing in New York State rose to its highest level in nine months, keeping in line with the trend of modest improvement in U.S. economic data.

Volume totaled 6.8 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, just above the daily average of 6.68 billion.

Advancing stocks outnumbered declining ones on the NYSE by about 3 to 2, while on the Nasdaq, advancers beat decliners by about 13 to 12.

(Reporting By Caroline Valetkevitch,; Editing by Jan Paschal)