"Wal-Mart issued upside guidance for its first fiscal quarter, [there was] an upgrade at Intel by Bank of America to buy from neutral and unemployment claims, while still high, were less than expected," said Robert Pavlik, chief investment officer at Oaktree Asset Management.
After erasing early losses to climb more than 100 points, the Dow Jones Industrial Average gained 54.72 points to 12,581.98, with 19 of its 30 components closing higher.
The S&P 500 Index rose 6.06 points to 1,360.55, and the technology-heavy Nasdaq Composite Index gained 29.58 points to 2,351.7, with the sector buoyed by Yahoo Inc.'s maneuvering to put more heat on Microsoft Corp. to hike its buyout bid. .
Shares of Yahoo gained 3%, while Microsoft's were up 0.8%.
"Bigger picture, we're still in a trading range for the most part. Folks are still trying to figure out which direction we're headed, and investors are waiting for more earnings reports to see where the economy stands and where the sectors are headed," said Pavlik.
Advancing sectors were led by information technology, up 1.4%, and consumer discretionary, up 1%. The utility sector was off 0.6%, while telecommunication services dropped 0.4%.
Early economic data revealed that the U.S. trade deficit widened sharply.
Other data had weekly jobless claims falling 53,000 to 357,000 last week. .
Volume on the New York Stock Exchange came to 3.6 billion, while nearly 2.2 billion shares were exchanged on the Nasdaq. On the NYSE, nearly two stocks posted gains for every one on the decline. On the Nasdaq, advancers beat decliners 4 to 3.
Retailers released same-store sales figures for March, with companies generally producing worse-than-forecast results. Limited Brands Inc. , Wet Seal Inc. and Pacific Sunwear of California Inc. were among the disappointments.
Wal-Mart proved an exception, with it shares up 1% after it lifted its view on first-quarter earnings and reported a 0.7% same-store sales rise.
Bed Bath & Beyond Inc. erased earlier losses to advance 0.7% after projecting first-quarter earnings per share may be as much as 32% below forecasts.
On the New York Mercantile Exchange, crude-oil futures fell 76 cents to end at $110.11 a barrel. .
Other action on the NYME had gold futures dropping $5.7 to $931.80 an ounce. .
Heading into Thursday's session, the Bank of England cut interest rates by a quarter-percentage point to 5%, citing "disruption in financial markets." The European Central Bank kept rates steady at 4%, while the central bank of Iceland -- known for having one of the highest interest rates in the developed world -- hiked rates by a half a point.
U.S. stocks on Wednesday saw their worst single day since March 28 after oil, gasoline and corn hit records and United Parcel Service Inc. cut its earnings outlook.
By Kate Gibson