The S&P 500 (SPX) gained 9 points, or 0.7%, to just under 1,400. The Nasdaq (COMP) added 21 points, or 0.7%, to 3,051.

Thursday's gains came one day after Fed chairman Ben Bernanke said central bank policy is "approximately in the right place at this point." But he added that the Fed is "prepared to take further action" if the economy deteriorates.

Some investors took the comments as a sign the Fed is willing to extend its asset purchasing program, known as quantitative easing, said Joseph Saluzzi, co-head of equity trading at Themis Trading.

"There's definitely some after-effects of Bernanke," Saluzzi said. "The stimulus addicts are still at it, and Bernanke certainly didn't shut the door."

Economy: The number of people filing for first-time unemployment benefits dipped 1,000 to 388,000 in the most recent week, according to the Labor Department's weekly initial claims report.

The jobless claims number fell to four-year lows a few months ago, but has been climbing recently. Economists surveyed by Briefing.com had expected the report to show that 365,000 people filed for their first week of jobless claims last week, down from 386,000 the week before.

Meanwhile, pending home sales rose 4.1% in March, according to the National Association of Realtors. The pending home sales index, which reflect contracts but not closings, was expected to have risen 0.5%, according to a consensus of analysts surveyed by Briefing.com.

Companies:After the market closed, Starbucks (SBUX, Fortune 500) reported better-than-expected quarterly earnings and raised its outlook for the full year. The coffee chain said it earned 40 cents per share in the quarter, beating estimates by a penny.

The coffee giant raised its full-year earnings estimates to a range between $1.81 and $1.84 a share. But analysts are expecting full-year earnings of $1.86 per share, according to Thomson Reuters. Shares fell 4% in extended trading.

Also after the close, Amazon (AMZN, Fortune 500) said it earned 28 cents per share in the first quarter, down from 44 cents per share a year ago. But the results were much better than the 7 cent per share profit analysts had predicted.

Before the opening bell, Exxon Mobil reported earnings of $2 per share, below expectations of $2.09. The nation's No. 1 oil company generated $9.45 billion in profits the quarter, compared to $10.65 billion a year earlier.

Shares of H&R Block (HRB) plunged 11% a day after the tax preparer said it would cut 350 full-time jobs nationwide and close 200 "underperforming" offices. The move should save H&R between $85 million to $100 million annually by the end of fiscal year 2013.

PepsiCo's (PEP, Fortune 500) stock edged lower after the company reported earnings of 69 cents per share and net revenue of more than $12.4 billion, beating expectations.

UPS (UPS, Fortune 500) reported earnings of $1 per share, missing expectations by 2 cents. The parcel delivery company, often seen as a bellwether of economic activity, reported revenue that was roughly in line with estimates. Shares fell 1.8%

Citrix Systems (CTXS) shares rose 12% after the business software maker said Wednesday that revenue rose 20% in the first quarter and raised its outlook for 2012 sales.

The Italian government auctioned €8.5 billion worth of 6-month notes at a yield of 1.77%. That's higher than last month's auction, signaling weaker demand since yields and prices move in opposite direction.

The yield on Italian 10-year bonds has been hovering around 6% for the past week or so. Italy will offer 5- and 10-year bonds Friday.