Analysts attributed gains to several factors, including further decline in the U.S. dollar and lower bond yields. Traders also noted some short covering ahead of options expiration on Friday.
"We have dollar weakness today. That continues to hold the key," said Peter Cardillo, chief market economist at Rockwell Global Capital. "There is complacency in the bond market and that's helping to ease that fear of yields climbing."
The U.S. dollar recovered slightly but held near recent lows, while the euro topped $1.14 for the first time since February. The U.S. 10-year Treasury yield fell to 2.24 percent, off Tuesday's high of 2.366 percent.
Read MoreDollar tumble does more than rattle markets
"The equity market is behaving appropriately because the uptik in Treasury bond yields has not been accompanied by (a better economic outlook)," said John Lonski, chief capital markets economist at Moody's. "During all this turmoil in the bond market we didn't have (the outlook for the) Fed funds move higher."
He said expectations in the Fed funds futures are for a December rate hike at the earliest, while GDP growth estimates continue to be lowered. The accelerated gains in the 10-year yield was more the result of being the yield falling too low in April, Lonski said, expecting it to remain in a range.
Tech stocks led the rally. Apple closed up 2.3 percent. Facebook broke its 50-day moving average with a 3.5 percent leap.
Microsoft extended recent gains, closing up 2.3 percent. On Wednesday, Deutsche Bank upgraded the stock to "buy"
from "hold," noting "investor enthusiasm about Azure and Office 365 is just starting to kick in."
Cisco fell 1 percent despite posting earnings after the close Wednesday that beat on both the top and bottom lines. In a conference call, outgoing CEO John Chambers said product orders in Russia, Brazil and China declined year-over-year, with China orders falling 21 percent. Orders for the Americas gained 2 percent from the same period last year.
"Their outlook for capex and demand was pretty positive," said Art Hogan, chief market strategist at Wunderlich Securities. "I think Cisco is part of it. When you have stocks pressed down because of the stronger dollar or higher yields, you have a beta trade."
Beta stocks have more volatility with market movements, falling more with stock index declines and gaining more with index advances.
Read MoreBonds coming off rally, not selling off: Strategist
Investors also attributed Thursday's gains to a relief rally on the postponement of a liftoff.
The data is "not as good as we would like to see. Not only is there little sign of recession, bonds seem to have finished their gains on top of these yields," said Bruce McCain, chief investment strategist at Key Private Bank. "People are shifting into equities."
Weekly jobless claims came in at 264,000, a touch below last week's reading and below expectations for a slight increase. The initial filings for unemployment benefits per week remain near 15-year lows.
"Jobless claims are positive on the employment growth picture," said Jim Dunigan, chief investment officer at PNC Asset Management. But "data continues to be lumpy."
The producer price index for April fell 0.4 percent, with the core figure down 0.2 percent, missing expectations for a slight gain. The monthly measure of input costs is a secondary factor in determining the rate of change in prices, after the consumer price index.
"All that points to less concern the Fed will increase rates in June," Dunigan said of the economic reports.
The Federal Reserve will eye both the employment situation and inflation for signs the economy is ready for an interest rate hike. Consensus is for a rate hike in September or later in the year, but central bank policymakers have not ruled out a June liftoff.
Futures looked past the mixed morning data, with the Dow futures continuing to hold gains of more than 100 points.
"Intraday oversold conditions returned during yesterday's consolidation phase, setting a positive tone for today," BTIG's chief technical strategist Katie Stockton said in a Thursday morning note. "A breakout has been elusive for the SPX as investors have focused beyond the equity market, but we are encouraged by improved momentum and relatively sanguine market internals."
Stocks closed little changed on Wednesday as soft retail sales and renewed gains in yields kept traders on edge.