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.
In midterm elections two years after he won the White House, Trump and his fellow Republicans were set to maintain their majority in the US Senate following a divisive campaign marked by fierce clashes over race, immigration and other cultural issues.
With a House majority, Democrats will have the power to investigate Trump's tax returns and possible conflicts of interest, and challenge his overtures to Saudi Arabia, Russia and North Korea.
- US midterm elections explained: Why they're so important
- The US mid-term elections: A beginner's guide
- What you need to know about the US mid-terms
They 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 hardline policies on trade.
Tuesday's result was a bitter outcome for Trump, a 72-year-old former reality TV star and businessman-turned-politician, after a campaign that became a referendum on his leadership.
Democrats turned out in droves to register disapproval of his 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 Trump's policy agenda.
The election results mean Democrats will resume House control in January for the first time since the 2010 election, beginning a split-power arrangement with the Republican-led Senate that may force Trump to scale back his legislative ambitions and focus on issues with bipartisan support.
It also 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.
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 Tuesday's 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.
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, and Andrew Gillum was trailing Republican Ron DeSantis in his quest to become the first African-American governor of the key swing state of Florida.
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.
All 435 seats in the House, 35 seats in the 100-member Senate and 36 of the 50 state governorships were up for grabs.