Newly re-elected President Barack Obama will once again deal with a divided Congress as Democrats retained control of the US Senate, while Republicans kept their solid majority in the House of Representatives.
Republicans were dealt a bitter blow by the Democrats, who had more seats to defend and were once seen as vulnerable in the Senate.
But two Republican candidates in Missouri and Indiana who had made damaging comments about rape and abortion were both defeated and an incumbent Republican fell in liberal Massachusetts.
Republicans also lost a seat in Maine, where an independent who is expected to vote with the Democrats won, while picking up a Democratic-held seat in Nebraska.
More than two billion dollars was spent on the fight for Congress. All 435 House seats were on the ballot, and Republicans retained control there, though Democrats made a few gains. That means Mr Obama will have difficulty passing any ambitious legislation in his second term.
Only a dozen or so Senate races out of the 33 on the ballot were seen as competitive, and almost all of those that were called yesterday – in Wisconsin, Virginia, Connecticut, Missouri, Ohio, Pennsylvania, New Mexico and Florida - went the Democrats’ way. That left them poised to retain or even increase their 53-47 advantage in the Senate.
Control of the Senate at the very least gives Democrats a firewall against Republican attempts to overturn Obama’s signature legislative achievement, his health care reform law, before it is fully implemented in 2014. Republicans had promised to repeal it.
Democrats began the year in a precarious position, defending 23 Senate seats and losing several retiring veterans in Republican-leaning states, all while voter discontent lingered over the sluggish economy and Mr Obama’s health care law.
But the Democrats fielded some strong candidates, and Republican prospects were undermined by some candidates who proved to be too conservative and by the surprise retirement of senator Olympia Snowe in Maine.
Ms Snowe, a moderate, voiced her frustration with the gridlocked Congress when she announced her retirement earlier this year. Independent Angus King, a former governor, won a three-way race to replace her.
Mr King has vowed to be a bridge between the parties and has not said whether he would side with the Democrats or Republicans. But he was expected to vote with the Democrats after Republican groups spent hundreds of thousands of dollars on ads attacking him.
Republicans will be left with only a few Senate seats in the north east. In Massachusetts, Republican Senator Scott Brown, who managed to win the seat once held by the late Edward Kennedy, was defeated by Democrat Elizabeth Warren, a favourite among liberals for her work as a consumer advocate.
Congress consistently rates low in public opinion surveys, but incumbents still tend to get re-elected.
They benefit from a system that gives them huge financial advantages in their re-election bids, and enjoy support from voters who tend to favour their own politicians even if they dislike Congress overall.
Many incumbents in the House were also helped by the once-a-decade redrawing of district boundaries, which has just been completed.
After the last of the Senate races is decided, moderates from both parties in Maine, Connecticut, Nebraska, North Dakota, Virginia, Indiana and Massachusetts will be gone, and another in Montana could lose.
At least one new moderate will fill one of those seats.
In Indiana, moderate veteran senator Dick Lugar had been expected to easily win re-election, but he lost a Republican primary to state treasurer Richard Mourdock, who was backed by the anti-tax, limited-government tea party movement.
Mr Mourdock came under withering criticism after saying in a debate that when pregnancy results from rape, it is “something God intended”. That opened the way for moderate Democratic congressman Joe Donnelly’s victory in a state carried by Republican Mitt Romney.
In Missouri, another state won by Mr Romney, Senator Claire McCaskill had been considered the most vulnerable Democratic incumbent, but she defeated another tea party-backed candidate, congressman Todd Akin, who won the Republican primary.
Mr Akin was disowned by Republican leaders, including Mr Romney, after he remarked in August that women’s bodies have ways of avoiding pregnancy in cases of what he called “legitimate rape”.
Two senators who rode a Democratic wave to the Senate in 2006 were elected to second terms: Sherrod Brown in Ohio and Bob Casey in Pennsylvania.
In Virginia, Tim Kaine, a former governor and Democratic national party chairman, won a costly, close race against former Republican senator and governor George Allen to replace the retiring Democratic senator Jim webb..
In the tight race in Wisconsin, Democratic congresswoman Tammy Baldwin prevailed in a close race with former governor Tommy Thompson and will become the first openly gay US senator.
In Connecticut, Democratic congressman Chris Murphy won the seat being vacated by retiring independent Joe Lieberman, the Democratic vice-presidential candidate in 2000.
Republicans had once hoped that the race would be won by Linda McMahon, the former head of World Wrestling Entertainment, who spent more than 42 million dollars of her own fortune in the race.
Some favourites of the tea party movement did well. Republican Ted Cruz, the son of a Cuban-born father, won the Senate race in Texas, while Deb Fischer won in Nebraska.
Senate races were still undecided early today in two conservative western states, Montana and North Dakota.
Republicans hope congressman Denny Rehberg will defeat Senator Jon Tester, who won a close race during the Democratic wave election of 2006. In North Dakota, Republican congressman Rick Berg was the slight favourite to defeat former state attorney general Heidi Heitkamp for the seat held by retiring Democratic senator Kent Conrad.
In the south west, Arizona congressman Jeff Flake won a tough race to capture a seat being vacated by a Republican. In Nevada, votes were still being counted in Republican senator Dean Heller’s hard-fought race with Democratic congresswoman Shelley Berkley.
Democratic Senate majority leader Harry Reid and Republican house speaker John Boehner were likely to remain leaders of their chambers.
In the Senate, Democrats would remain nowhere near the 60-vote supermajority needed to pass legislation easily under Senate rules.
Senate minority leader Mitch McConnell said Republicans in Congress are ready to work with Mr Obama.
Mr McConnell said: “To the extent he wants to move to the political centre, which is where the work gets done in a divided government, we’ll be there to meet him halfway.”