A late-afternoon slide on Wall Street dragged stocks broadly lower Wednesday, wiping out early gains and adding to losses from a day earlier as investors worry about the economic fallout from surging coronavirus cases in the U.S.

The S&P 500 fell 1.2%. It had been up 0.3% in the early going after Pfizer and BioNTech reported updated data suggesting their potential COVID-19 vaccine may be 95% effective. The companies said they plan to ask U.S. regulators within days to allow emergency use of the vaccine.

The news, which followed encouraging data on Monday about a vaccine being developed by Moderna, initially gave investors cause for optimism that the virus-ravaged economy could begin to heal next year. But such optimism is being tempered by a spike in coronavirus cases and worries that it will lead to widespread restrictions on businesses once more.

Coronavirus counts and hospitalizations are up across the country, and health experts are warning about the possibility of a brutal winter.

“This is a market that is fluctuating as it makes a determination about the effect that the COVID-19 restrictions and lockdowns have on the reopening of the U.S. economy, versus the positive news that stems from potential vaccinations beginning in 2021,” said Quincy Krosby, chief market strategist at Prudential Financial. “It’s sort of a tug-of-war.”

The S&P 500 fell 41.74 points to 3,567.79. The Dow Jones Industrial Average dropped 344.93 points, or 1.2%, to 29,438.42. The Nasdaq composite lost 97.74 points, or 0.8%, to 11,801.60.

Small-company stocks, which have notched the biggest gains this month, gave up 22.60 points, or 1.3%, to 1,769.32.

Newly confirmed coronavirus infections per day in the U.S. have exploded more than 80% over the past two weeks to the highest levels on record, with the daily count running at close to 160,000 on average. Cases are on the rise in all 50 states. Deaths are averaging more than 1,155 per day, the highest in months.

The surge is leading governors and mayors across the U.S. to grudgingly issue mask mandates, limit the size of private and public gatherings, ban indoor restaurant dining, close gyms or restrict the hours and capacity of various businesses. Wednesday’s afternoon sell-off on Wall Street accelerated after New York City said it would close its public schools to in-person learning again as infections continue to rise there.

Despite shedding modest gains from earlier in the day, stocks remain close to their record highs. Hopes for a coronavirus vaccine coming in the future have helped push stocks higher this month as some investors look past the worsening pandemic in the present.

“That story seems to be moderating a little bit here as the coronavirus news has now mostly been digested by the marketplace,” said Tom Martin, senior portfolio manager with Globalt Investments. “The vaccine news immediately captures the imagination because you see an endpoint.”

Companies that would benefit most from a healing, reopening economy, such as airlines and banks, helped push the market higher in the early going Wednesday, though the stocks gave up much of their gains by the end of the day. United Airlines gained 1.1% and American Airlines added 0.3%.

All told, technology, health care and communication services stocks accounted for much of the decline.

Many risks remain for the market. Chief among them is the pandemic, which is accelerating so quickly that governments across the United States and Europe are bringing back varying degrees of restrictions on businesses.

Even with the encouraging figures from pharmaceutical companies about their potential vaccines, there’s also still no guarantee one will be approved or how long it will take for it to be widely distributed.

Federal Reserve Chair Jerome Powell on Tuesday warned of the potential economic damage in the next few months because of the pandemic. Additional lockdown orders would keep customers away from businesses. But even if the strictest stay-at-home orders don’t return, fear alone of the virus could keep consumers hunkered at home.

Powell and other economists have said another big financial-support program from Congress could help tide the economy over. But bitter partisanship in Washington has prevented any deal to renew extra unemployment benefits for laid-off workers and other stimulus efforts that expired earlier this year.

In Europe, a coronavirus relief package is being held up by a diplomatic dispute between Hungary and Poland and several other major EU countries.

The yield on the 10-year Treasury ticked up to 0.87% from 0.85% late Tuesday. A report showed that homebuilders broke ground on more new houses last month than economists expected.

European stock markets rose. In Asia, Japan’s Nikkei 225 fell but other markets were stronger.