With the House of Representatives firmly in Democratic control, the battle for the Senate focused Wednesday on Virginia, where razor-thin margins raised the prospect of lengthy recounts.
In Virginia, the Republican incumbent, Senator George Allen, trailed the Democratic challenger, Jim Webb, by a margin well below the 1 percent that allows for a losing candidate to demand that ballots be counted again.
A recount in Virginia could mean prolonged uncertainty over control of the Senate, since a formal request can be filed only after the results are officially certified on Nov. 27, according to the state board of elections. Last year a recount in the race for Attorney General was not resolved until Dec. 21.
If the Senate ends up evenly split, the Republicans would remain in control by virtue of Vice President Cheney's tie-breaking role. Members of both parties began adjusting to the Democrats' victory in the House, a sharp turnaround in the fortunes of the party and a sea change in the political dynamics in Washington after a dozen years in which Republicans controlled both houses of Congress for all but a brief period.
President Bush telephoned Representative Nancy Pelosi, the California Democrat who will become the first woman to serve as Speaker of the House. Mr. Bush also scheduled a news conference for 1 p.m. Eastern time today.
No less significant for the long-term political fortunes of their party, Democrats were winning governors' seats across the country - notably in Ohio, a state that has been at the center of the past two presidential elections.
Among the faces that will be absent from the halls of Congress next year are some high-profile and long-serving members of the Republican Party, including Representatives Charles Bass of New Hampshire. E. Clay Shaw Jr. of Florida, J.D. Hayworth of Arizona, Jim Ryun of Kansas and Nancy L. Johnson of Connecticut.
The parade of departing Republican senators also included Mike DeWine of Ohio, Rick Santorum of Pennsylvania, Lincoln Chafee of Rhode Island and Jim Talent of Missouri, who conceded his race to Claire McCaskill well after midnight.
Karl Rove, the president's top political strategist, alerted the president that the House was lost at around 11 p.m., the White House said.
"His reaction was, he was disappointed in the results in the House," Tony Fratto, a White House spokesman. "But he's eager to work with both parties on his priorities over the next two years. He's got an agenda of important issues he wants to work on, and he's going to work with both parties."
One of the Democrats Mr. Bush telephoned - Representative Steny Hoyer of Maryland, a contender for majority leader - said in a televised interview that the president spoke of a need for the two parties to work together, particularly on Iraq.
In talk show appearances, tired-looking and glum Republican officials were also stressing bipartisanship.
Ken Mehlman, the chairman of the Republican National Committee, spoke of trying to move the debate on important issues out of the partisan political arena during an appearance on Fox News.
Drawing comparisons with World War II, he said the "threat of Islamic fascism" was neither "a Republican threat nor a Democratic threat" and that there was "no reason we can't work on a bipartisan basis on an issue like that."
By contrast, tired-looking and elated Democrats stressed the need for the change in direction that they had made the centerpiece of the campaign.
Representative Rahm Emanuel, the Illinois Democrat who led his party's campaign this fall in the House, said that while he believed in bipartisanship, his party was ready to pursue an ambitious agenda, beginning with ethics reform.
By any measure, the result was a sobering defeat for a White House and a political party that had just two years ago, with Mr. Bush's re-election, claimed a mandate to shape both foreign and domestic policy and set out to establish long-term dominance for the Republican Party.
To the end, Mr. Rove had expressed public confidence that the electoral tools he had used to great effect in his long association with Mr. Bush - a sophisticated get-out-the-vote effort, an aggressive effort to define Democratic candidates in unflattering ways, a calculated and intense campaign to fuel the enthusiasm of conservative voters - would save the Republicans from defeat.
In light of the defeat, Mr. Bush's aides were striking a more conciliatory tone as they faced the prospect of two years of divided government and a clearly enlivened Democratic Party.
"We always recognized this was going to be a very challenging year," Ken Mehlman, the Republican Party chairman, said on CNN. "We have to continue to work and try to work on a bipartisan basis to accomplish things."
In the Senate, one of the Republicans' top targets - Senator Robert Menendez, Democrat of New Jersey - survived a nearly $5 million onslaught by the Republican Party to defeat Thomas H. Kean Jr.
In New York, Eliot Spitzer breezed to victory, becoming the first Democrat in 12 years to move into the governor's mansion in Albany, and Senator Hillary Rodham Clinton won easy re-election. In Connecticut, Senator Joseph I. Lieberman, running as in independent, defeated the man who beat him in the Democratic primary, Ned Lamont.
The election to a large extent became a national referendum on Mr. Bush and the war in Iraq, according to exit polls.
Sixty percent of voters leaving the polls yesterday said they opposed the war in Iraq, and 40 percent said their vote was a vote against Mr. Bush. In addition, a significant number of voters said corruption was a crucial issue in their decision, in a year in which Republicans have struggled with scandal in their ranks. Independent voters, a closely watched group in a polarized country, broke heavily for Democrats over Republicans, the exit polls showed.
Ms. Pelosi took note of the importance of the war in the outcome in her own victory speech early this morning.
"Nowhere did the American people make it more clear that we need a new direction than in Iraq," she said, speaking to cheers. "We can not continue down this catastrophic path. So we say to the president, 'Mr. President, we need a new direction in Iraq. Let us work together to find a solution to the war in Iraq.' "
In a sign of the political mindsets of both parties going into last night, Democrats had arranged an elaborate rally to gather the election results in Washington; Republicans had not.
Beyond the change in party power, the result signaled that the House was in for something of an ideological scramble. While the result was marked by the defeat of a procession of Republican moderates - from New Hampshire, Connecticut and Florida - the new class of Democrats include congressmen-elect who are considerably more moderate than many of their new brethren. In Indiana, Representative John Hostettler, a Republican, was defeated by Brad Ellsworth, a Democrat and sheriff who opposes abortion rights and same-sex marriage.
Democrats picked up six governors' seats currently held by Republicans, most significantly in Ohio, where Representative Ted Strickland won. Mr. Strickland's victory, along with the defeat of Mr. DeWine by Sherrod Brown, signaled that Ohio was no longer the Republican bulwark that it has long been.
At stake was Republican control of both the House and the Senate in the most competitive midterm election since Republicans seized control in 1994. That was the last time one party took control of both houses away from the other. This year, Democrats were looking to win 15 seats to capture the House and 6 to win the Senate.
The day included concerns about electronic voting machines being used for the first time in many parts of the country, as well as about often strict new voter registration laws. Problems were reported in a dozen states, including Indiana and Ohio. In parts of eight states, polling hours were extended.
President Bush cast his vote in Crawford, Tex., then returned to Washington to watch the returns at the White House with a group that included Mr. Mehlman and Mr. Rove.
Throughout the day, Republican Party officials said they were encouraged by reports of what they said was high turnout in typically Republican parts of the country, as well as counts of early votes and absentee ballots. They disputed early exit poll findings that suggested that Republican candidates might be in trouble, though they acknowledged the problems the party's candidates faced this year.
The voting finished an often bitter campaign that pitted a Democratic Party frustrated by years of losses against a White House and a Republican Party acutely aware that losing control of the House or the Senate would fundamentally alter the remainder of Mr. Bush's presidency.
The Republicans went into the campaign with institutional advantages.
Because of redistricting, few incumbents appeared vulnerable initially. Republicans also had what both parties viewed as the considerable advantage of a powerful and sophisticated get-out-the-vote machine the Republican Party began putting together as soon as Mr. Bush took office in 2001.
Once again, Republicans had a financial advantage, even though vigorous fund-raising efforts by Democrats narrowed the historic gap. Over all, Republicans spent $559 million, compared with $456 million by Democrats, according to records filed with the Federal Election Commission. And Mr. Rove made clear that he believed Republicans could again roll to victory by emphasizing terrorism and national security issues, as they have in both national elections since the attacks of Sept. 11, 2001.
But by the middle of October, Republicans found they were struggling with what several described as the worst political environment in a generation, making it easier, according to exit polls yesterday, for Democrats to achieve their central strategic objective: Turning this election into a national referendum on Mr. Bush's leadership and, more generally, on Republican stewardship.
The war in Iraq deteriorated throughout the fall, the American death toll spiked in October, and public opinion turned more firmly against the conflict. Eight in 10 voters who said they approved of the war in Iraq voted Republican, and 8 in 10 voters who said they disapproved voted Democratic, the exit polls said.
In contrast to 2004 and 2002, when the president was sought after by Republican candidates throughout the country, Mr. Bush was extremely unpopular in many parts of the country this year, limiting the places where he was welcome to campaign. He was shunned by his party's candidate for governor in Florida on Monday, and Democrats ran hundreds of advertisements featuring their Republican opponents standing or sitting next to Mr. Bush. Nearly 4 in 10 voters leaving the polls said their vote yesterday was cast against Mr. Bush.
The Republicans also struggled with corruption scandals, including the resignation in September of Representative Mark Foley, Republican of Florida, after he admitted sending sexually inappropriate messages to teenage pages.
By the end of the campaign, Republicans said they had been forced to spend money in races that should never have been in play, including the one to replace Mr. Foley and another for the seat once held by Tom DeLay of Texas, the former Republican majority leader who resigned from Congress after being indicted on charges of conspiring to violate Texas election laws.