Stocks staged a late-day comeback on Thursday as strong quarterly profits from consumer bellwethers like Starbucks Corp outweighed worries about Greece's shaky finances.

First-quarter earnings are on track to set a record for the percentage of companies beating estimates. Eighty-five percent of the 98 S&P 500 companies that have reported so far have beaten estimates, well above the 61 percent in a typical quarter, according to Thomson Reuters.

Illustrating the revival of consumer spending, coffee chain

Starbucks and SanDisk Corp , which makes flash memory for mobile phones, digital cameras and other gadgets, both posted results that beat estimates.

Starbucks shot up 7.3 percent to $27.25 and SanDisk surged 12.3 percent to $42.22. Hershey Co's profit nearly doubled and its shares rose 7.2 percent to $48.08.

The S&P consumer discretionary index <.GSPD> ended up 1.7 percent, while the S&P retail index <.RLX> climbed 2.1 percent.

The earnings in this reporting period have been very strong, and the real positive is on the revenue side. You've really seen revenues begin to kick in and that shows private sector spending, said Tim Ghriskey, chief investment officer of Solaris Asset Management, in Bedford Hills, New York.

The consumer is waking up and satisfying some of this pent-up demand.

The Dow Jones industrial average <.DJI> climbed 9.37 points, or 0.08 percent, to 11,134.29. The Standard & Poor's 500 Index <.SPX> rose 2.73 points, or 0.23 percent, to 1,208.67. The Nasdaq Composite Index <.IXIC> gained 14.46 points, or 0.58 percent, to 2,519.07.

Data pointing to further stabilization in the labor market added to the positive tone and helped reinforce optimism about the U.S. economic recovery. Big manufacturers also fared strongly, with Boeing Co up 2 percent at $75.59.

Besides SanDisk, iPhone maker Apple Inc also contributed to the strength in technology shares, rising 2.8 percent to finish at $266.36, another record close.

After the bell investors got even more earnings news but it appeared to temper some of the optimism seen earlier in the day. Amazon.com Inc issued a forecast for quarterly revenue and profit that disappointed investors, sending its shares down 6 percent in after-hours trading.

Microsoft Corp , a Dow component, posted a stronger-than-expected 35 percent jump in quarterly profit, but its stock fell about 5 percent after the bell to $29.83 since investors had expected an even stronger performance.

During the regular session traders said investors were encouraged that a speech on financial reform by President Barack Obama carried no new anti-Wall Street barbs.

Initial weekly claims for state unemployment benefits dropped 24,000 to a seasonally adjusted 456,000, the Labor Department said, resuming a downward trend that had been interrupted by the Easter holiday. Markets had expected 455,000.

A separate report showed sales of previously owned homes rose 6.8 percent to an annual rate of 5.35 million units in March as Americans rushed to take advantage of a tax credit for home buyers, the National Association of Realtors said.

The Dow Jones home construction index <.DJUSHB> rose 4.4 percent.

Even with the gains, lingering concerns about Greece limited a broader market advance. Earlier, the benchmark S&P 500 had slid by about 1 percent due to unease about Greece.

The cost of insuring Greek debt hit a record high after the European Union said Greece had larger budget deficits last year than anticipated.

Moody's downgraded Greece's sovereign ratings, fanning investors' fears that European national debt problems could derail the global economic recovery.

About 10.64 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, above last year's estimated daily average of 9.65 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of 2 to 1, while on the Nasdaq about five stocks rose for every three that fell.

(Additional reporting by Leah Schnurr; Editing by Kenneth Barry)