Wall Street wrapped up the third quarter on a high note Wednesday, even as a maelstrom of uncertainty surrounding the pandemic and stimulus hopes weighed on investors.

Better-than-expected jobs data, progress toward a possible coronavirus treatment by Regeneron Pharmaceuticals and promising results from Moderna’s coronavirus vaccine trials spurred some positive sentiment on Wall Street. But conflicting signals about an possible stimulus deal from Treasury Secretary Steven Mnuchin and Senate Majority Leader Mitch McConnell (R-Ky.) dampened gains.

The Dow Jones industrial average seesawed but closed up 329 points, or 1.2 percent, at 27,781.70. The S&P 500-stock index climbed more than 27 points, or 0.8 percent, to settle at 3,363.00. The tech-heavy Nasdaq advanced 82 points, or 0.7 percent, to settle at 11,167.51.

September is a historically tough month for stocks, but this one was particularly volatile following months of dizzying highs. The major U.S. indexes posted their first monthly losses since March. The S&P 500 slumped nearly 4 percent, the Dow erased 2.3 percent, and steep sell-offs in tech shaved 4.9 percent off the Nasdaq.

This week, coronavirus deaths surpassed 1 million worldwide as Europe wrestled with the beginnings of a second wave. Analysts say possible economic head winds are still swirling.

“The economy faces no shortage of risks in the near-term including uncertainties associated with the election, fall and winter COVID-19 challenges, and failure of elected officials in Washington to pass further economic relief legislation,” Mark Hamrick, senior economic analyst at Bankrate, wrote in commentary Wednesday.

Despite the rockiness of September, Wall Street bagged its best back-to-back quarters since 2009, with the S&P 500 growing 8.5 percent and the Dow gaining 7.6 percent in the third quarter. The Nasdaq added 11 percent from July through September, for its best two consecutive quarters since the early 2000s. The market’s sharp turnaround has nonetheless created the most uneven recovery in modern U.S. history, according to analysis by The Washington Post.

While the nation overall has regained nearly half of the lost jobs during the pandemic, several key demographic groups have recovered more slowly, including mothers of school-age children, Black men, Black women, Hispanic men, Asian Americans, younger Americans (ages 25 to 34) and people without college degrees.

New data from the Bureau of Economic Analysis released Wednesday showed the depth of the damage to the overall economy last quarter, estimating that the GDP dropped 31.4 percent as stay-at-home orders lifted and the federal government distributed aid to struggling businesses and households.

This week, Disney said it would lay off 28,000 people across its theme park division in the United States because of the toll the pandemic has taken on its core business. Royal Dutch Shell also announced up to 9,000 layoffs this week as it shifts away from fossil fuels. Boeing, American Airlines and United Airlines all ticked higher Wednesday after news broke of widespread impending layoffs in the air travel industry.

Investors are looking to the monthly jobs report on Friday for a better sense of whether more job losses are becoming permanent. Analysts expect to see a slight drop in the unemployment rate, which stood at 8.4 percent in August.

“One reason for temporary job losses becoming permanent is the length of the pandemic; the longer it runs, the higher the chances of business failures,” Beth Ann Bovino, chief U.S. economist at S&P Global, wrote in a jobs report preview Wednesday. “On top of that, if state and local governments — which are some of the country’s largest employers — don’t get budget relief from the federal government, there will likely be more pressure to cut positions, rather than just furlough employees.”

Jeffrey Kleintop, chief global investment strategist with Charles Schwab, called it “an unconvincing end to the quarter” as momentum in earnings and in the economic recovery slowed. He said individual investors have yet to embrace the rally, even amid record-setting highs.

“Take today. The best-performing sector is health care … and the second-best performer is consumer staples. Those two usually do well when the market is going down,” Kleintop said. “The economically sensitive sectors are the weakest and the most defensive ones are the strongest. To me, that’s not a sign of a durable rally.”

Chris Rupkey, chief financial economist for MUFG, said in an email that he expects the next quarter to be marked by economic growth. But whether that holds for the nation’s GDP will be determined by the success rate of coronavirus vaccines and the results of the election.

“This is looking like a short recession that will be just two quarters long and we haven’t seen such a brief downturn like this since the 1980s,” he said. “Hopefully, the record job losses will also recover just as fast as spending in the economy.”

October, another historically turbulent time for traders, is sure to be a spectacle as investors parse the potential for a deadly second wave of coronavirus infections and the upcoming presidential election. While the United States is mired in political uncertainty, Tuesday’s contentious presidential debate probably didn’t move markets, according to David Bahnsen, chief investment officer at the Bahnsen Group.

“The election is not the primary driver of markets right now,” Bahnsen wrote in commentary Wednesday. “The level of economic reopening is.”