The result upends the balance of power in Washington, where Trump has enjoyed an easy ride from Republican dominance of both houses of Congress since his shock election in 2016
Democrats seized control of the House of Representatives on Tuesday in a midterm setback for Donald Trump, but the US president managed to avoid a feared "blue wave" as his Republican Party expanded its Senate majority after a polarizing, racially charged campaign.
Heralded by Trump as a "tremendous success," the Republican Senate victories will all but end any immediate talk of impeachment, even as the Democratic-led House will enjoy investigative powers to put new checks on his roller-coaster presidency.
Just after polls closed on the West Coast, Trump took to Twitter to hail his party's performance.
But network projections said that Democrats would take control of the House for the first time in eight years, upending the balance of power in Washington where Trump enjoyed an easy ride following his shock 2016 election with Republican dominance of both chambers.
Democrats were on course to flip at least 26 seats from Republican hands, with strong performances among suburban white women who had narrowly turned to Trump two years ago and in key battleground states such as Pennsylvania.
Representative Nancy Pelosi, who is likely to return as speaker of the House despite opposition from some centrist Democrats, promised that the party will serve as a counterweight - but also work with Trump.
"Today is more than about Democrats and Republicans. It's about restoring the constitution's checks and balances to the Trump administration," Pelosi told a news conference.
But she added: "A Democratic Congress will work for solutions that bring us together, because we have all had enough of division."
Democrats will now be able to block legislation and light a fire under Trump's feet with investigations of his opaque finances and Russian interference in the 2016 election.
Tuesday's contest saw several historic firsts in the Democratic camp: in Kansas Sharice Davids --an attorney and former mixed martial arts fighter - became the first Native American woman elected to Congress.
And in the Midwest a onetime Somali refugee, Ilhan Omar, and Rashida Tlaib, who is the daughter of Palestinian immigrants, shared the historic distinction of becoming the first two Muslim women elected to the US Congress.
But the rosiest expectations of some Democrats - that they could create a "blue wave" even when playing defense on the Senate map - proved unfounded.
Republicans were forecast to have defeated several Democratic senators in states won by Trump - Florida, Indiana, Missouri and North Dakota.
Trump boasted a growing economy but campaigned aggressively in the closing days on a hardline anti-immigration message.
He seized on scenes of a caravan of Central American migrants heading through Mexico for the US, mused on ending the constitutional guarantee of citizenship to all people born in the United States and ran a television advertisement, deemed too provocative to air by mainstream networks, that linked Democrats to a criminal who was an undocumented immigrant.
Trump also has sent soldiers to the Mexican border and threatened to have illegal immigrants shot if they throw stones.
"It's a consequential election," Yorgo Koutsogiogasi, a 64-year-old immigrant from Greece and CEO of a hospitality company, said as he voted in Chicago.
"Divisiveness is really tearing the country apart," Koutsogiogasi, a Democrat, said as he voted with his wife. "I'm voting for candidates that I believe have the capacity to unite people rather than divide."
But Republican voter James Gerlock, 27, said he wanted to see more of the soaring economic growth that Trump says is the fruit of his business-friendly policies.
"I am extremely happy with the economy," Gerlock said as he cast his ballot in Chicago. "I just want to keep everything moving, because I'm loving it."
Democrats claimed some high-profile victories, with former professional hockey player Colin Allred defeating Pete Sessions, the chairman of the powerful House Rules Committee in suburban Dallas.
But also in Texas, Democratic Senate candidate Beto O'Rourke, a charismatic congressman and former punk rock singer who had raised an unprecedented $60 million in his mission to win in the Republican stronghold, fell short to arch-conservative former presidential contender Ted Cruz.
O'Rourke had told voters that Trump was wrong and described Texas as built from "immigrants, asylum seekers and refugees."
Districts around the country reported unusually high turnout: according to Michael McDonald of the US Elections Project, 38.4 million Americans cast their ballots early ahead of this election, compared with 27.4 million in the 2014 midterm.
Trump had noted the energy as he wrapped up a punishing schedule of rallies around the country that were intended to boost Republican candidates - and his own brand heading towards reelection in 2020.
"The midterm elections used to be, like, boring," Trump told a crowd in Cleveland on Monday. "Now it's like the hottest thing."