The Federal Reserve set off the rally a day earlier by indicating that it was in no hurry to raise interest rates.
The gains were led by technology stocks as Oracle soared following better-than-expected earnings. Industrial and health care stocks also logged big gains. Even the energy sector advanced, despite another drop in the price of oil.
Fed Chair Janet Yellen said Wednesday that she foresaw no rate hike in the first quarter of 2015. The comments eased concerns that policymakers would start raising interest rates at a time when growth outside the U.S. appears to be flagging. They also helped investors look past worries about the impact of a slumping oil price and turmoil in Russia, where the currency has slumped.
The Standard & Poor’s 500 index rose 48.34 points, or 2.4 percent, to 2,061.23.
The Dow Jones industrial average gained 421.28 points, also 2.4 percent, to 17,778.15. The Nasdaq Composite gained 104.08 points, or 2.2 percent, to 4,748.40.
Oracle was the biggest gainer in the S&P 500 index after it reported earnings late Wednesday that beat the expectations of Wall Street analysts. The company said its software and cloud revenue grew 5 percent. The stock rose $4.19, or 10.2 percent, to $45.35.
The company’s advance helped push up the tech sector 3 percent.
Investors are betting that as the economy improves and unemployment continues to fall, companies will start to invest in technology to boost productivity.
Stocks rose sharply Thursday even as oil resumed its slide.
The price of oil fell $2.36 to close at $54.11 a barrel, after rising as high as $58.71 in morning trading. Oil has plunged since June, when it peaked at $107 a barrel.
Overproduction and weak demand are behind the fall in global oil prices. Brent crude, a benchmark for international oil, fell $1.91 to close at $59.27 in London.
A rapid descent in oil prices was the catalyst for big losses on the stock market a week earlier.
While falling oil prices are good for consumers, putting more money in their pockets by cutting gas prices, they are bad for energy companies. Oil has fallen almost 50 percent from a peak of $107 a barrel in June.
U.S. government bond prices fell. The yield on the benchmark 10-year government Treasury note climbed to 2.21 percent from 2.14 percent a day earlier.
In currency trading, the euro fell to $1.2274 from $1.2329 the previous day. The dollar edged higher against the Japanese yen, climbing to 118.83 yen from 118.83 yen.
Prices for precious and industrial metals were little changed. Gold edged up 30 cents to $1,194.80 an ounce, silver was essentially unchanged at $15.93 an ounce and copper fell two cents to $2.85 a pound.
In other futures trading on the NYMEX:
Wholesale gasoline fell 3.9 cents to close at $1.527 a gallon.
Heating oil fell 7 cents to close at $1.939 a gallon.
Natural gas fell 6 cents to close at $3.642 per 1,000 cubic feet.