U.S. Democrats won a majority in the House of Representatives in Tuesday's midterm elections, gaining power to investigate President Donald Trump and help shape the country's political agenda for the next two years.

With several races yet to be decided, it was clear that Democrats captured more than the 218 seats needed to break the Republicans' eight-year hold on the lower house that began with the Tea Party revolt of 2010.

"Tomorrow will be a new day in America," declared House Minority Leader Nancy Pelosi, now in line to become the next House speaker.

Pelosi discusses restoring checks and balances on the Trump administration:

Nancy Pelosi, who is poised to return to the House as majority leader, says the midterm results are about restoring the constitution's checks and balances to the Trump administration. 1:16

While Republicans further solidified their control over the Senate, the Democratic wins in the House ended their monopoly on power in Washington and opened a new era of divided government.

Republican Mike Braun ousted Indiana Democratic Sen. Joe Donnelly, incumbent Ted Cruz held off challenger Beto O'Rourke in Texas and Marsha Blackburn defeated former Tennessee governor Phil Bredesen to keep a hotly contested Senate in Republican hands — all important steps in the party's drive to keep hold of the 100-seat upper chamber.

Blackburn promises Trump's agenda will be advanced, wall built:

Tennessee Senator-elect Marsha Blackburn says Republicans will advance President Trump's agenda in Congress and "make certain that we build that wall." 0:40

With divided leadership in Congress and a president who has taken an expansive view of executive power, Washington could be in store for even deeper political polarization and legislative gridlock.

As the majority party, the Democrats will chair important committees and have expansive powers to investigate the president, his business dealings and the inner workings of his administration, including whether anyone from the Trump campaign colluded with the Russians to influence the 2016 presidential election.

LIVE BLOG RECAP: U.S. midterm elections 2018, as they happened

They will have authority to request Trump's tax returns and subpoena power to obtain documents, emails and testimony. They will also likely use their new majority to reverse what they see as a hands-off approach by Republicans toward Trump's foreign policy, and push for tougher dealings with Russia, Saudi Arabia and North Korea.

However, any attempt to impeach Trump is likely to run headlong into resistance in the Republican-controlled Senate.

The Democrats also could force Trump to scale back his legislative ambitions, possibly dooming his promises to fund a border wall with Mexico, pass a second major tax-cut package, or carry out his hard-line policies on trade.

President reacts

Trump said the midterm results "defied history," during a speech at the White House at midday Wednesday. He took credit for the Republican gain in the Senate and for minimizing losses in the House. He also called out Republican candidates who lost, for not asking for his "embrace" during the campaign.

Trump also said he hopes to work with Democrats on issues such as infrastructure building and drug prices.

"It really could be a beautiful bipartisan situation," he said.

However, ahead of Tuesday's vote, Trump made only passing reference to his $1.5 trillion-tax cut — the Republican Congress's signature achievement — and instead barnstormed through mostly white regions of the country with dark and foreboding warnings. He predicted an "invasion" from the migrant caravan making its way toward the U.S. and decried the "radical" agenda of speaker-in-waiting Pelosi.

On Tuesday night, Trump called to congratulate the California lawmaker and acknowledged her plea for bipartisanship, according to her spokesperson.

Pelosi is likely to face a challenge for the speakership from newer or younger members later this month. And the Democrats could see a struggle inside the party over how aggressively to confront the Trump administration.

During the campaign, Pelosi urged candidates to focus on lowering health-care costs and creating jobs with infrastructure investment, and she tamped down calls for impeachment.

Losing the House will test Trump's ability to compromise, something he has shown little interest in over the last two years with Republicans controlling both chambers of Congress. There may, however, be some room to work with Democrats on issues with bipartisan support such as an infrastructure improvement package or protections against prescription drug price increases.

A congressional win by Democrat Ilhan Omar, centre, was just one of several historic results from Tuesday's midterm elections. (Eric Miller/Reuters)

In locking down a majority, Democratic candidates flipped seats in several suburban districts outside Washington, Philadelphia, Miami, Chicago, Denver and Dallas that were considered prime targets for turnover because they were won by Hillary Clinton in 2016. The Democrats made only slight inroads in Trump country, where they tried to win back white working-class voters.

Midterm elections are typically difficult for the party in power, but the Republicans' hold on power was further weakened by an unusually large number of retirements, as well as infighting between conservatives and centrists over their allegiance to Trump.

The Democrats, in turn, benefited from extraordinary voter enthusiasm, robust fundraising and unusually fresh candidates. More women than ever were running, along with veterans and minorities, many of them motivated by revulsion over Trump.

At 29, Alexandria Ocasio-Cortez is the youngest woman ever elected to Congress. She shocked many, including herself, last spring when she came out of nowhere to defeat 10-term Rep. Joe Crowley in New York's Democratic congressional primary.

The victory made her the national face of young, discontented Democrats — often women and minorities — trying to shove their party to the left.

Alexandria Ocasio-Cortez calls Democrats' House gains 'a movement':

Newly-elected U.S. Democratic Representative Alexandria Ocasio-Cortez says Tuesday's midterm signifies a "larger movement for social, economic, and racial justice in the United States of America.” 0:27

Former president Barack Obama, who campaigned for the Democrats, lauded the diversity of the party's candidates in a statement on Wednesday.

"Even more important than what we won is how we won: by competing in places we haven't been competitive in a long time, and by electing record numbers of women and young veterans of Iraq and Afghanistan, a surge of minority candidates, and a host of outstanding young leaders," the statement said. "The more Americans who vote, the more our elected leaders look like America."

Congratulations to everybody who showed up and participated in our democracy in record numbers yesterday. The change we need won’t come from one election alone – but it is a start. Last night, voters across the country started it. <a href="https://t.co/gNk4WkeJUn">pic.twitter.com/gNk4WkeJUn</a> —@BarackObama

In Virginia, political newcomer Jennifer Wexton defeated two-term Rep. Barbara Comstock. The Republican incumbent had been branded Barbara "Trumpstock" by Democrats in a race that pointed to Trump's unpopularity among college-educated women in the suburbs.

In south Florida, former Health and Human Services Secretary Donna Shalala defeated Republican Maria Elvira Salazar.

Officials from both parties react after Americans head to the polls:

Officials on both sides of the aisle react after Americans headed to the polls in polarized midterm elections that saw Democrats retake the House and Republicans retain control of the Senate. 3:30

But Democrats failed to defeat a vulnerable incumbent in Kentucky, where Republican Rep. Andy Barr won over former Marine fighter pilot Amy McGrath. On the Senate side, they also failed to fend off Braun in Indiana.

And Rep. Steve King, an Iowa Republican, won re-election despite publicly losing a corporate supporter and facing criticism from some within his own party for inflammatory remarks on immigration and race.

Presidential hopefuls

Democrat Tony Evers defeated Wisconsin Gov. Scott Walker, denying the polarizing Republican and one-time presidential candidate a third term.

Evers' win on Tuesday was a huge victory for Democrats, who couldn't find the recipe to take out Walker in three previous elections, including a 2012 recall.

Republican Mike Braun defeated the incumbent Democratic senator in Indiana. (Michael Conroy/Associated Press)

Senators Bernie Sanders of Vermont and Elizabeth Warren of Massachusetts easily won re-election as they consider bids for the Democratic presidential nomination. Other 2020 prospects on the ballot included New York Sen. Kirsten Gillibrand and New York Gov. Andrew Cuomo, who both held onto their seats, too.

Sen. Bernie Sanders says Trump continues to divide the country:

Re-elected Senator Bernie Sanders says President Trump is trying to divide Americans instead of bringing them together. 0:55

Two high-profile races remained up in the air Wednesday.

In Georgia, Democratic gubernatorial candidate Stacey Abrams wouldn't concede the tight race against Republican Brian Kemp. "You're going to have a chance to have a do-over," Abrams said, hinting at a runoff.

And Florida Democratic Sen. Bill Nelson, seeking re-election, said the race against Republican challenger Rick Scott was too close to call.

"We are proceeding to a recount," he said in a statement, though only the secretary of state — Ken Detzner, an appointee of Scott, the current governor — can call for a recount.

In the hours after the first polls closed Tuesday, White House press secretary Sarah Huckabee Sanders downplayed the possibility of a Democratic rout, saying "maybe you get a ripple, but I certainly don't think that there's a blue wave."

Sarah Huckabee Sanders speaks to reporters, playing down the possibility of a big Democratic win:

White House Press Secretary Sarah Huckabee Sanders insists President Donald Trump's agenda isn't going to change regardless of which party is in control of the House or Senate. 1:23

Sanders said Trump called Senate majority leader Mitch McConnell "to congratulate him on historic Senate gains" and also called Democratic Senate minority leader Chuck Schumer and o​utgoing House Speaker Paul Ryan.