Stocks ended in the black on Thursday, with major indexes roaring back late from major losses earlier in the session, as a late-year rebound in equities continued for a second day.

The failure of an initial selloff to gain more momentum lent credence to the idea that the extended bout of selling pressure may be coming to an end for now. The gains come a day after the major indexes posted their largest daily percentage increases in nearly a decade. 

The S&P 500’s two-day percentage gain of 5.9 percent is the best performance for the benchmark index since late August 2015 when the market was in the midst of a downturn over a slowing China.

Even so, all three major indexes remain down more than 9 percent for December. The S&P 500 is on track for its biggest annual percentage drop since 2008.

Stocks were lower for most of Thursday’s session, and strategists said such a pullback was to be expected following the huge jump on Wednesday, when the Dow Jones Industrial Average rose 1,000 points for the first time.

Almost in unison, stocks across market sectors began rising around 2:30 p.m. ET, shortly after the S&P 500 briefly broke below 2,400, a level that has been repeatedly tested during the last several days of choppy trading. From there the index surged 3.8 percent to close at its highest point in a week.

Even the clutch of technology and internet stocks that were the largest drags through the first several hours of trading recovered most or all of their losses. Apple gained 4 percent from its low and Amazon was up 5 percent; both finished the day about 0.6 percent lower.

Microsoft, which had been among the largest drags on the S&P 500, rose 4.8 percent to finish 0.6 percent higher on the session, ending up as the third-largest improvement to the index.

The steep pullback in recent months, which has seen the Nasdaq confirm a bear market and the S&P 500 come within a whisker of doing so, may have created some bargains that are attracting buyers.

Trade tensions between the United States and China, an expected slowdown in U.S. corporate profit growth and the general health of the economy remain concerns for investors heading into 2019.

A measure of consumer confidence posted its sharpest decline in more than three years in December, deflating some optimism a day after a report that holiday sales were the strongest in years helped mollify concerns about the health of the economy.

Approximately 9 billion shares changed hands on the major domestic equity exchanges, a number that was just below the 9.2 billion share daily average over the last 20 trading sessions.

Unemployment Claims Fall

According to a report released by the Labor Department on Thursday morning, the number of new claims for jobless benefits fell marginally last week to near a 49-year low, pointing to underlying strength in the labor market. Initial claims for state unemployment benefits fell by 1,000 claims to a seasonally adjusted 216,000 claims for the week ended Dec. 22.

Initial claims have now fallen in three of the last four weeks and are just above the 49-year low of 202,000 reached in the week ended Sept. 15. However, after several years of near-steady falls, claims trended higher between mid-September and mid-December, prompting concern.

It remains unclear how much of that increase was related to the difficulty government statisticians have in adjusting the claims data for seasonal swings. Claims can be volatile at the end of the year when U.S. holidays throw off a model that the government uses to smooth the data for seasonal fluctuations.

The Labor Department said claims were estimated last week for the states of California, Kansas, Texas and Virginia.

The four-week moving average of initial claims, considered a better measure of labor market trends as it irons out week-to-week volatility, fell by 4,750 claims to 218,000 claims last week.

The claims report also showed the number of people receiving benefits after an initial week of aid decreased 4,000 to 1.70 million for the week ended Dec. 15. The four-week moving average of the so-called continuing claims fell 1,000 to 1.68 million.

Consumer Confidence Falls

Consumer confidence slumped in December to the lowest since July as a gauge of labor market expectations fell by the most in 41 years, the latest sign Americans are growing less optimistic as stock markets gyrate and the expansion moderates.

The confidence index decreased to 128.1 from 136.4, according to a report Thursday from the New York-based Conference Board. A measure of consumer expectations fell to a two-year low while the share of people expecting more jobs in the next six months decreased to 16.6 percent from 22.7 percent, the biggest drop since 1977.

“Back-to-back declines in expectations are reflective of an increasing concern that the pace of economic growth will begin moderating in the first half of 2019,” Lynn Franco, senior director of economic indicators at the Conference Board, said in a statement released with the data.

Despite the steep fall in employment expectations, consumer perceptions about the current state of the job market remain upbeat. The labor differential, measuring the gap between respondents saying jobs are plentiful and those saying jobs are hard to get, climbed to the highest since 2001.

Optimism, which recently reached an 18-year high, is slipping after months of rising uncertainty about the trade war and President Donald Trump’s attacks on the Federal Reserve, which have whipsawed financial markets. That’s been accompanied by a weakening economic outlook for next year amid fresh signs that the housing market is cooling off and the manufacturing sector is starting to falter.

Another weak spot was household plans to spend on big-ticket items. Measures of the share of consumers who plan to buy cars, homes and major appliances such as refrigerators in the next six months all declined.

The Bloomberg Consumer Comfort Index’s monthly expectations gauge fell to a one-year low in December as more respondents said the economy is getting worse. Meanwhile, the weekly comfort measure, released earlier Thursday, rebounded somewhat from a three-month low.