U.S. stocks rallied on Thursday following four losing sessions as data showed the U.S. economy grew faster than expected in the third quarter after more than a year of contraction.

Quarterly profits at consumer product giants Procter & Gamble Co
and Colgate-Palmolive Co both surpassed expectations, also lifting sentiment.

Shares of Dow component P&G, which also raised its full-year revenue outlook, gained 3.7 percent to $59.34. Colgate shares rose 0.9 percent to $78.39.

The first estimate of U.S. gross domestic product showed the economy expanded at a 3.5 percent annual rate, unofficially ending the worst recession in 70 years. A Reuters poll last week found economists looking for a 3.3 percent gain, although some recent data led many to trim forecasts this week.

The data suggests that we're going to see very positive GDP for at least the next two or three quarters, said Hank Smith, chief investment officer at Haverford Trust Company in Philadelphia. I don't see much chance for negative territory for at least a year.

The data provided fuel for the S&P 500 index to resume its seven-month run-up after sagging for four straight days.

The Dow Jones industrial average <.DJI> added 98.39 points, or 1.01 percent, to 9,860.55. The Standard & Poor's 500 Index <.SPX> gained 13.64 points, or 1.31 percent, to 1,056.27. The Nasdaq Composite Index <.IXIC> gained 29.49 points, or 1.43 percent, to 2,089.09.

The Dow gains were smaller as energy bellwether Exxon Mobil Corp reported third-quarter earnings that fell from the prior year and missed expectations. The stock, the world's biggest by market capitalization, fell 1.5 percent to $72.71.

While Exxon came in below expectations, many other companies reported quarterly results above Wall Street's forecasts, including Kellogg Co , Tenneco Inc , Motorola Inc and Aetna Inc .

Also on Thursday, data from the Labor Department showed that the number of U.S. workers filing new claims for jobless benefits fell last week, though not by as much as expected.

(Editing by Padraic Cassidy)