Democrats gained control of the U.S. House of Representatives while Republicans retained their grip on the Senate following midterm elections seen as a referendum on President Donald Trump's first two years in office. The results were in line with predictions made by polling companies and betting markets.

President Trump called House Minority Leader Nancy Pelosi shortly before midnight Tuesday to congratulate her on the Democrats victory in the House, according to media reports.

Democrats won at least 221 seats and are ahead in more than half a dozen of the remaining races. Republicans won 197 seats and were leading in 10 of the races still to be called as of Wednesday, Politico reported. It takes 218 seats to control the House.

The new Senate will have at least 51 Republicans and 46 Democrats. Republicans were ahead in the three races that haven't been called likely giving Republicans a 54-46 majority. That compares with the current line-up of 51 Republicans, 47 Democrats and 2 independents, who both vote with Democrats. Republicans held onto contested seats in Tennessee and Texas, and defeated incumbent Democrats in Indiana and North Dakota, to ensure control of the upper chamber. 

U.S. stocks rose Wednesday in the wake of the election. However, the main drivers of investor sentiment -- negative prospects of an ongoing trade war with the China and the effects of tariffs on U.S. corporate profits along with concern about the pace of benchmark interest rate increases -- aren't likely to change, most Wall Street analysts said.

The Democratic-controlled House is likely to generate political headaches for President Trump, including deepening probes into whether the Trump campaign colluded with Russia in the 2016 election or whether the President is using his office to enrich himself. The Republicans' Senate control should insulate him from the worst possible outcome, which would be impeachment, conviction and removal from office.

The risks of greater partisanship "could have serious market and economic consequences, such as potentially more frequent government shutdowns, impeachment considerations and general uncertainty," said Societe Generale analysts including global research head Brigitte Hiddon.

In a press conference Wednesday, Trump called the results "close to a complete victory," notwithstanding the Democrats takeover of the House. He vowed to react to any investigations of him or his administation with a "warlike posture."

The election is not likely to resolve the widening conflicts between supporters of President Trump and his opponents. Trump campaigned strongly for Republicans without emphasizing the strengths of the U.S. economy, now expanding for the 10th straight year. Last week the government reported that employers added 250,000 jobs in October and that the unemployment rate remained 3.7 percent, the lowest level in nearly 50 years. Pay also rose at a healthy pace amid rising consumer confidence.

The split decision in Congress likely heralds a legislative gridlock that won't imperil Trump's economic agenda or the passage of laws that will discourage investors, since legislative activity will probably slow down considerably in the coming year.

Bank stocks, as measured by the SPDR S&P Bank ETF (KBE) - Get Report , are down about 7.5% so far this year. Three interest rate increases this year, which should have increased lending income, haven't inspired investors, said JJ Kinahan, Chief Market Strategist at TD Ameritrade. "The financials have not been able to get going in this anticipated higher rate environment," Kinahan told TheStreet.

Still, the end of the election cycle will have the benefit of eliminating uncertainty about the result, and has been good for stocks in the past. Not only has the Standard & Poor's 500 stock index been higher one year after every midterm election since 1946, the fourth quarter of the midterm election year and the first two quarters of the following year have historically been the most bullish nine months in the four-year presidential cycle, according to data from LPL Financial.

A split Congress won't mean the undoing of the president's big moves so far, such as a massive tax cut passed in late 2017, analysts say. Nor will it affect Trump's rollback of business regulations, as those were decided by executive action rather than new laws passed by Congress. There's a chance that both parties will team up to get an infrastructure bill passed. A split Congress, however, will doom Trump's hopes for additional tax cuts.

Budget negotiations with Trump are also likely to intensify as Democrats look to push back on spiraling deficits due to unfunded tax cuts. On the plus side, investors may welcome a Democratic "pushback on protectionism," which could help de-escalate the president's trade fight with China.

Stephen Guilfoyle, a trader who contributes the TheStreet's sister publication Real Money, said the mixed result might prompt President Trump to seek accommodation with Democrats on such things as rebuilding the nation's infrastructure. In such a case he recommended stocks including United Rentals (URI) - Get Report , Caterpillar (CAT) - Get Report  , Vulcan Materials (VMC) - Get Report , or U.S. Concrete USCR

"If this nation ever sees a deal on a large infrastructure deal.... gridlock is the way that gets done, and everyone claims victory," Guilfoyle wrote.