The Dow Jones Industrial Average closed 542.52 points higher, or 1.95%, at 28,390.18. Earlier in the day, the 30-stock average was higher by more than 600 points. The S&P 500 climbed 1.95% to 3,150.45 and the Nasdaq Composite advanced 2.6% to 11,890.93. Thursday also marked the first time since 1982 that the Dow and S&P 500 rose at least 1% in four straight sessions.
Those gains put the major averages on pace for their biggest weekly gains since April. The Dow was up 7.1% week to date. The S&P 500 and Nasdaq were up 7.4% and 9%, respectively, over that time period.
Facebook and Amazon both gained more than 2%. Netflix, Apple and Microsoft each closed more than 3% higher. Shares of Facebook have also gained 12% this week. Amazon and Apple have risen 9.4% and 9.3%, respectively, over that time period while Microsoft has popped 10.3%.
Investors in this high growth sector cheered a potential divided government as it likely means taxes won't go up, antitrust scrutiny could stay in check and the China trade war doesn't get any worse.
"Investors are content with a divided-government scenario," said Brian Jacobsen, senior investment strategist at Wells Fargo Asset Management. "In that scenario, there's not that much the president can do" in terms of policy.
NBC News projects that former Vice President Joe Biden is the winner in Wisconsin and Michigan, both states that President Donald Trump won in the 2016 presidential election. Biden would then be just 17 Electoral College votes away from winning, NBC News reported Wednesday.
Meanwhile, the Democrats were projected to retain control of the House, while flipping the Senate became increasingly unlikely.
"It looks likely that we'll see a split Congress, which, based on history, has been the preference of the stock market," said Lindsey Bell, chief investment strategist at Ally Invest. "You can see this expectation being priced into the market [Wednesday] with health care, communication services and technology stocks are leading the market."
To be sure, the Trump campaign said it would seek a recount in Wisconsin. Meanwhile, a Pennsylvania appeals court ordered the state to set aside mail-in ballots with pending ID-verification issues not be counted until the court makes a further decision. The campaign also filed a suit in Georgia seeking to require all counties there to separate ballots that arrive after the voting deadline from other, "legally cast ballots."
NBC News has yet to call the battleground states of Arizona, Nevada, Georgia, Pennsylvania and North Carolina. But even though the presidential race is still in question, investors cheered the prospects of a divided government as that would curb most efforts by Democrats to raise corporate taxes or regulate Big Tech.
"With no blue wave, we are likely to see the Senate remain very closely divided, which will constrain the policy options of whoever wins the presidency. That probably rules out any substantial activity on taxes, as well as limiting any actions to control the major tech firms," said Brad McMillan, chief investment officer at Commonwealth Financial Network.
However, some strategists noted that a contested election, which is not off the table at this point, could lead to a sharp drop in stocks over the short-term.
"More than anything, the market is looking for a peaceful transition of power. Social unrest or a contested election could trigger a significant increase in volatility," said Don Calcagni, chief investment officer of Mercer Advisors.
Sentiment on Thursday also got a boost from better-than-expected earnings out of Qualcomm and General Motors. Qualcomm's stock popped 12.8%. General Motors shares gained 5.4%.
Elsewhere, the Federal Reserve said Thursday it kept interest rates unchanged near zero, noting the economy remained well below pre-pandemic levels.
Subscribe to CNBC PRO for access to the live stream of CNBC's continuous election and business news coverage.