If the big rally on Wall Street after the midterm elections is any guide, gridlock is good for stocks.

U.S. equities jumped sharply higher Wednesday after the midterm elections set the stage for a newly divided Congress, an outcome that eased fears about a big change in policy that could hurt corporate profitability.

The Dow Jones Industrial Average rallied more than 545 points, or 2.1 percent, to 26,180, boosting its gain for the year to 5.9 percent and leaving it just 2.4 percent shy of its October record high. The rally was broad, with the Standard & Poor's 500 stock index rising 2.1 percent and the technology-dominated Nasdaq composite gaining 2.6 percent.

Wall Street woke up to a partisan power split in Congress and a likely period of legislative gridlock after the Democrats regained control of the House, ending two years of Republican control of both branches of Congress under Republican President Donald Trump. The GOP retained its majority in the Senate.

The vote result, however, was widely expected by investors. The new Capitol Hill alignment that will take effect in January isn't viewed as a major game-changer for the economy or markets, largely because the split Congress makes it unlikely that legislation would undo parts of President Trump's agenda – such as large tax cuts and deregulation of business.

Investors also avoided the most-feared Wall Street outcome, a so-called "blue wave," or Democratic sweep of both chambers of Congress. That could have put the president's economic policies under assault and boosted the odds of a Democratic House pushing for Trump's impeachment.

"Everything played out according to script," Stephen Innes, head of Asia trading at Oanda, told USA TODAY. "The Trump agenda is not in serious jeopardy."

Still, the House will likely make things tough on Trump and move to block his agenda, adds Mark Hamrick, senior economic analyst at Bankrate.com

"House Democrats will turn up the pressure on President Trump through investigations and oversight," Hamrick said.

Legislative gridlock has historically been good for financial markets. In fact, in years with a Republican president and a Republican-controlled Senate and Democrat-run House in place, the Standard & Poor's 500 stock index has posted average gains of 10.8 percent, according to data from Strategas Research Partners.

"A split Congress means that gridlock is more likely, and that's been fine for markets in the past," says Kate Warne, investment strategist at Edward Jones.

In the past, after the uncertainty around the midterm elections has been eliminated after the vote, stocks have performed well, posting higher returns a year after every midterm election since World War II. The Dow also has posted average gains of 4 percent in the fourth quarter of midterm election years going back to 1896, data from LPL Research show.

A Democrat-controlled Congress would have been greeted less well by investors, as it would have increased concerns about the possible rollback of Trump-driven policies, adds David Joy, chief market strategist at Ameriprise Financial.

"The outcome of the elections was not a tail risk event," Joy says, referring to a surprise outcome similar to the Brexit vote in 2016 that rocked markets. "The markets were afraid there would be a blue wave, which would have resulted in a government that was perceived as less business friendly."

The stock market also tends to rise once the uncertainty of the election is out of the way, allowing investors to return their focus to things such as the outlook for the economy and corporate earnings, adds Joe Quinlan, chief market strategist at U.S. Trust.

"The unknown is behind us," Quinlan says. "There were no surprises so investors can refocus on business fundamentals, which are solid and supportive of rising equity prices."

Wall Street's focus now will shift to existing headwinds, such as U.S. and China trade tensions and the Federal Reserve's interest rate hike plans, Quinlan says.

Political gridlock, Quinlan adds, could result in less fiscal stimulus from the federal government, which means there is "less risk" of the U.S. economy overheating, which could lead to less aggressive interest rate hikes from the Federal Reserve.

More Money:Midterm election not seen rocking 401(k) plans, but surprise outcome could roil stocks

More Money:Duncan Hines recalls 2.4 million boxes of cake mix for potential salmonella risk

More Money:Status update: Facebook catches pop-up fever, opening first retail shop in 9 Macy's stores