Stocks on Wall Street rallied to a record on Friday with investors seeing the chance to finally move past the presidential election even as the persistent spread of the coronavirus threatens to undercut the outlook for the economy.

A string of events seemed to reassure investors that Joseph R. Biden Jr. would move into the White House in January without incident, after a week and half of tumult and uncertainty about the Trump campaign’s efforts to reverse the outcome of the vote.

The state of Georgia was called in the former vice president’s favor on Friday, with Arizona having been added to his column the night before. Mr. Biden had already won the election before those two calls, but they raised his electoral tally to 306 votes, giving him a decisive victory.

President Trump’s campaign also lost a court challenge in Michigan, withdrew one in Arizona, and saw some of its lawyers withdraw from a case in Pennsylvania. Put together, those moves gave investors a touch more clarity about what to expect in 2021, giving stocks the push they needed to advance into record territory.

“We may actually have capitulation from the White House and be able to say that the election is finally behind us,” said Steve Sosnick, chief strategist at Interactive Brokers in Greenwich, Conn.

The S&P 500 rose 1.4 percent Friday, exceeding its Sept. 2 closing record of 3,580.84. Wall Street had toyed with that high for days, first because of the view that the presidential election delivered an outcome that could lead to growth next year, and later after Pfizer released surprisingly good trial results for its vaccine candidate. The rally has left the S&P 500 up 9.6 percent this month.

And despite levels of infection that have surpassed the frightening first stage of the outbreak — raising the prospect of fresh lockdowns to stem the rise — investors appeared to bet on a short-term improvement in the economic outlook.

Banks, industrial companies and small stocks — all of which are sensitive to near-term expectations for growth — were among the best performers of the day Friday. Shares of companies that have become barometers of sentiment toward the pandemic also reflected optimism: Simon Property Group, the shopping mall operator, gained 8 percent, and MGM Resorts rose more than 9 percent.

Companies that have benefited as consumers huddled at home amid the pandemic, like Peloton Interactive and Zoom Video Communications, were lower.

The gains on Friday came despite the surge in coronavirus cases in the United States and the potential for new efforts to contain the spread that might also hurt the economy.

Besides the threat the virus poses to the economy, some analysts cautioned that investors still had some political uncertainty to navigate, namely because the balance of power in the U.S. Senate remains to be resolved in two runoff elections in Georgia in January.

Democrats could still take control of the chamber, potentially opening the door to tax increases on corporations and wealthy individuals that many in the markets see as a headwind for stocks. Meanwhile, little progress appears to be getting made on another round of Federal economic aid, which most economists say is a must to keep the economy from slowing yet again.

“There is simply too much risk right now for this market to continue to rally, and I would anticipate we will see a pullback in the near future,” said Doug Rivelli, president of the institutional brokerage firm Abel Noser in New York.

That said, recent events seem to have reinvigorated appetite for stocks among investors.

In the week after the election — in which Mr. Biden was declared president-elect on Saturday, and Pfizer and BioNTech announced that their vaccine candidate was 90 percent effective in clinical trials on Monday — money has poured into equity markets.

Bank of America Merrill Lynch analysts noted on Friday that the week that ended on Wednesday saw $32.5 billion course into U.S. equity funds, the second largest weekly inflow of all time.