Democrats rode a wave of dissatisfaction with US President Donald Trump to win control of the US House of Representatives where they will seek to keep his agenda in check and open his administration to intense scrutiny, while the President's Republican Party will hold Senate control.
In midterm elections two years after he won the White House, Mr Trump and his fellow Republicans were set to maintain their majority in the US Senate, CNN, NBC and ABC News projected, following a divisive campaign marked by fierce clashes over race, immigration and other cultural issues.
With some races still undecided, Democrats appeared headed to a gain of more than 30 seats, well beyond the 23 they needed to claim their first majority in the 435-member House in eight years.
With a House majority, Democrats will have the power to investigate Mr Trump's tax returns and possible conflicts of interest, and challenge his overtures to Saudi Arabia, Russia and North Korea.
They could also force Mr 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 hardline policies on trade.
In the House, Democrats picked up seats across the map, ousting incumbent Republican Barbara Comstock in suburban Virginia and sending Donna Shalala, a former Cabinet secretary under President Bill Clinton, to the House in south Florida.
In the Senate, where Republicans were heavily favoured to keep control heading into voting, Republican Mike Braun captured incumbent Joe Donnelly's seat in Indiana and Republican Kevin Cramer beat incumbent Democratic Senator Heidi Heitkamp in North Dakota.
Night of firsts: Candidates make history in US midterms
Voting machine problems cause delays at polling stations
Poles apart: A guide to the US midterms
US networks and Facebook pull anti-immigrant Trump ad
Some of the biggest Democratic stars of the campaign season were struggling.
Liberal House member Beto O'Rourke became a national sensation with his underdog US Senate campaign but fell short in conservative Texas.
Incumbent Democratic Senator Joe Manchin won a hotly contested race in conservative West Virginia, and conservative Marsha Blackburn held a Senate seat for Republicans.
Senators Bernie Sanders of Vermont, a 2016 Democratic presidential contender, and Tim Kaine of Virginia, Hillary Clinton's vice presidential nominee in 2016, easily won re-election, news networks projected.
Democratic Senator Sherrod Brown was projected to hold his seat in Ohio.
In New York, 29-year-old Democratic candidate Alexandria Ocasio-Cortez is set to become the youngest woman ever elected to Congress.
Earlier this year, she secured a surprise win when she defeated Congressman Joe Crowley in the Democratic primary.
All 435 seats in the House, 35 seats in the 100-member Senate and 36 of the 50 state governorships were up for grabs.
Democrats turned out in droves to register disapproval of Mr Trump's divisive rhetoric and policies on such issues as immigration and his travel ban targeting several Muslim-majority countries.
A record number of women ran for office this election, many of them Democrats turned off by Mr Trump's policy agenda.
The election results mean Democrats will resume House control in January for the first time since the 2010 election.
It would start a split-power arrangement with the Republican-led Senate that may force Mr Trump to scale back his legislative ambitions and focus on issues with bipartisan support, such as an infrastructure improvement package or protections against prescription drug price increases.
It also will test Mr Trump's ability to compromise, something he has shown little interest in over the last two years with Republicans controlling both chambers of Congress.
The loss of power will test Mr Trump's political hold on House Republicans, most of whom had pledged their support for him lest they face the wrath of the party's core supporters, who remain in his corner.
Most Democratic candidates in tight races stayed away from harsh criticism of Mr Trump during the campaign's final stretch, focusing instead on bread-and-butter issues like keeping down healthcare costs, maintaining insurance protections for people with pre-existing medical conditions and safeguarding the Social Security retirement and Medicare healthcare programs for senior citizens.
Democrats in the House could be banking on launching an investigation using the results of US Special Counsel Robert Mueller's already 18-month-old probe of allegations of Russian interference on Mr Trump's behalf in the 2016 presidential election.
A simple House majority would be enough to impeach Mr Trump if evidence surfaces that he obstructed justice or that his 2016 campaign colluded with Russia.
But Congress could not remove him from office without a conviction by a two-thirds majority in the Republican-controlled Senate.
Moscow denies meddling and Mr Trump denies any collusion.
The result is a bitter outcome for Mr Trump after a campaign that became a referendum on his leadership.
Down the stretch, Mr Trump hardened his rhetoric on issues that appealed to his conservative core supporters, issuing warnings about a caravan of Latin American migrants headed to the border with Mexico and condemnations of liberal American "mobs."
Additional reporting: Brian O'Donovan