By Joe Wallace and Michael Wursthorn

U.S. stocks surged Wednesday, led by a rally in technology shares, as investors appeared to coalesce around the idea of a divided U.S. government.

Although the outcome of the presidential election remained uncertain as crucial battleground states like Georgia, Michigan and Pennsylvania continued to tally votes, neither Republicans or Democrats received a clear mandate from voters that would preface broad policy changes, analysts and traders said.

So far, Republicans appeared poised to remain in control of the Senate, while the odds of former Vice President Joe Biden topping President Trump in the electoral count brightened. That outcome is sure to hamper any ability by Democrats to push a progressive agenda, including changes to taxes, health care and how tech companies are regulated.

"The trade going into this was anticipating a blue wave," said RJ Grant, a director of equity trading at KBW Inc. "Now, it looks like there's going to be more political gridlock."

The broad S&P 500 index gained 2.6% in recent trading, while the Dow Jones Industrial Averaged added 561 points, or 2%. The tech-heavy Nasdaq Composite jumped even higher, gaining 3.6%.

Still, investors may be overlooking the risk to the economy posed by a divided government, said Priya Misra, head of global rates strategy at TD Securities. If the Republicans retain the Senate, it will make it harder to juice the economy with more stimulus, she added.

Wednesday's gains followed a wild night of premarket trading. S&P 500 futures had briefly turned red after President Trump accused Democrats of trying to disenfranchise his voters and promised to petition the Supreme Court, though he didn't elaborate.

They turned positive again after counts in Wisconsin and Michigan pointed toward possible wins for Mr. Biden, though a substantial number of ballots remain uncounted.

"The market has been underpricing the chance of a close result," said Seema Shah, chief strategist at Principal Global Investors. "I'm surprised U.S. equities are doing as well as they are," Ms. Shah added, saying she expected to see more wild swings in stock prices in the near term.

Despite the volatility, traders described Wednesday's action as orderly, saying investors largely avoided making outsize bets one way or another ahead of the election. Many tried to avoid the scenario in 2016 where many investors were caught flat footed in the wake of President Trump's victory then.

Still, the lack of a decisive result are keeping markets on edge.

Money managers had long pinpointed a drawn-out or contested result as having the potential to spark big swings in asset prices. In part, this is because such an outcome would diminish the chances of lawmakers quickly passing a second round of economic stimulus. A lack of Democratic gains in the Senate also appeared to lower the likelihood of that happening.

Wagers that a Democratic sweep of the White House and Congress would lead to the speedy passage of more aid had sent investors into value stocks, such as financials, and pushed bond yields higher in the days leading up to the election.

That trade unwound Wednesday as the chances of a "blue wave" faded. The yield on the 10-year Treasury note fell to 0.768% from 0.881% Tuesday, putting it on course for its biggest one-day drop in months.

"This is a mega, mega move," said Gregory Perdon, co-chief investment officer at U.K. private bank Arbuthnot Latham. The prospects of a wave of Treasury issuance to fund a burst of federal spending under a Democratic administration had faded, he said. Yields fall as bond prices rise.

Another sign that stimulus hopes waned: The Russell 2000 index of smaller stocks lagged behind, rising just 0.4%. Companies in the index are more exposed to economic growth and were more likely than big tech stocks that dominate the Nasdaq and S&P 500 to benefit from a government spending package.

Big technology stocks powered markets higher. Apple, Amazon.com and Google owner Alphabet all gained ground. Uber Technologies rose 13% and Lyft around 11% after California voters approved an initiative that let the ride-hailing firms count their drivers as independent contractors.

Shares of banks and industrial companies, which are closely tied to the outlook for the economy and tend to suffer when longer-term bond yields slide, came under pressure.

In a sign that investors were reaching for haven assets, the dollar initially rose against a basket of currencies tracked by The Wall Street Journal.

China's yuan, Japan's yen, the euro and the British pound all fell against the U.S. currency, though some of those gains later reversed. European government bond yields also fell, with German 10-year bunds briefly touching negative 0.66%, their lowest level since March.

--Mischa Frankl-Duval contributed to this article.

Write to Joe Wallace at Joe.Wallace@wsj.com and Michael Wursthorn at Michael.Wursthorn@wsj.com

(END) Dow Jones Newswires

11-04-20 1157ET