Banks and energy companies led US stocks higher Thursday, erasing modest losses from the day before.
Retailers and makers of consumer products also posted solid gains. Small-company stocks rose more than the rest of the market, but technology stocks lagged. Trading was mostly subdued as investors looked ahead to the long holiday weekend.
‘‘Most of the optimism of the tax plan was probably built into the market already, and I thought we might be in a little bit of a sideways mode here for a while,’’ said Randy Frederick, a vice president at Charles Schwab. ‘‘But we’ve pretty much gained back almost what we gave up in the last two days. It’s a pretty good sign to see that.’’
The Standard & Poor’s 500 index rose 0.2 percent, to 2,684.57. The Dow Jones industrial average gained 0.2 percent, to 24,782.29. The Nasdaq added 0.1 percent, to 6,965.36. The Russell 2000 index of smaller-company stocks picked up 0.5 percent, to 1,547.11.
The indexes are all on course to finish the month with solid gains. They have risen over the past few weeks as Washington moved closer to passing its tax overhaul, but they haven’t done much over the last several days as Congress voted on the bill.
On Thursday, the market received some encouraging data on the economy.
The Commerce Department said the US economy grew at a solid 3.2 percent annualized rate in the third quarter, slightly slower than previously estimated. The latest GDP estimate follows a 3.1 percent gain in GDP for the second quarter. Combined, the two quarters represent the best back-to-back quarterly growth rates in three years.
‘‘GDP is still strong,’’ said Tom Martin, senior portfolio manager at GLOBALT Investments. ‘‘A revision of one-tenth of a percentage point is really not much.’’
Banks and other financial companies accounted for a big portion of the market’s gains. Wells Fargo rose 2.4 percent.
Oil prices veered higher, reversing losses from earlier in the day. The rebound helped lift energy stocks. Hess climbed 5.3 percent.
Benchmark US crude added 27 cents to settle at $58.36 a barrel. Brent crude gained 34 cents to close at $64.90 in London.
Several big retailers and makers of consumer products also posted solid gains. Toy maker Mattel added 3.9 percent, and Tiffany & Co. gained 2.4 percent.
Investors bid up shares in companies that beat earnings or outlook forecasts.
Finish Line jumped 12.9 percent after the athletic shoe and apparel retailer reported its quarterly revenue came in ahead of analysts’ estimates. It also posted a loss that was more modest than analysts were expecting. Consulting firm Accenture rose 1.6 percent after it reported earnings that beat analysts’ estimates.
Technology stocks, which are on track for an annual gain of 38 percent, the biggest gain this year, lagged the most on Thursday. Micron Technology was among the big decliners, sliding 2.9 percent.
The utility PG&E plunged 12.9 percent after it suspended its dividend to conserve cash amid concerns it may be found liable for wildfires in California.