Republicans scored a stunning electoral rout in the midterm elections, taking control of the U.S. Senate after a bitter campaign in which anger at Washington gridlock was turned against a president who took office promising to transcend it.

By early Wednesday, Republican candidates had won at least 10 of the day’s 13 closely contested Senate races. They took seats held by Democrats in Iowa, Colorado, Arkansas, Montana, South Dakota, West Virginia and North Carolina — more than enough to seize control of the Senate for the first time since 2007.

In addition, Republicans won at least 10 more seats in the House, adding to their majority. And GOP candidates won gubernatorial races from Florida to the high plains, including those in deep-blue Maryland and Massachusetts.

In Senate races, Democrats appeared to have kept just one of the states they had spent two years and millions of dollars trying to save — New Hampshire, where incumbent Jeanne Shaheen defeated Scott Brown (R), the former Massachusetts senator who had moved across the state line to run again from his vacation home.

And in Virginia, Democrats spent much of the night fearing they would lose a seat they thought was safe. Late Tuesday, Sen. Mark R. Warner (D) declared victory by a razor-close margin over Republican Ed Gillespie.

The GOP gained control of the Senate Tuesday night, taking hold of the legislative agenda in that chamber. Here are three of the policies Republicans are likely to tackle as they take the reins in January 2015. (Julie Percha/The Washington Post)

Senate races in Louisiana and Alaska remained undecided late Tuesday.

The contest in Louisiana will not be settled until December, when Sen. Mary Landrieu (D) will face Rep. Bill Cassidy (R) in a runoff election. And final results in Alaska’s race could be delayed for days as votes flow in from far-flung villages.

In Kentucky, Senate Minority Leader Mitch McConnell (R) — who won his reelection race Tuesday — signaled that, if he is chosen as majority leader, he will seek to work with President Obama.

“I think we have a duty to do that. Just because we have a two-party system doesn’t mean we have to be in perpetual conflict,” McConnell told supporters in Louisville. “I think I’ve shown that to be true at critical times in the past. I hope the president gives me the chance to show it again.”

In other races, Republicans defeated two Democratic incumbents who once epitomized their party’s model for winning elections in red or purple states.

Sen. Mark Pryor (D-Ark.) — a gun-friendly centrist focused on home-state priorities and the son of a state Democratic legend — was defeated by Rep. Tom Cotton (R), a conservative Army veteran and Harvard Law School graduate who cast the mild-mannered Pryor as a pushover for Obama.

In Colorado, Sen. Mark Udall (D) had won his seat in 2008 stressing his long ties to the state as director of Colorado Outward Bound. On Tuesday, he was beaten by Rep. Cory Gardner (R), a folksy House member who stressed his even deeper ties to the state as a fifth-generation Coloradan.

Election 2014
The midterms. Live.
Blog updates, plus all the top headlines, in one seamless experience.  Follow along

Meanwhile, in West Virginia, Rep. Shelley Moore Capito (R) won the race to replace the retiring Sen. John D. Rockefeller IV (D). Capito will be the first female senator in the state and the first Republican senator from West Virginia since the 1950s. And in Iowa, Republican Joni Ernst will become her state’s first female senator after defeating Democrat Bruce Braley.

“We are heading to Washington . . . and we are going to make ’em squeal!” Ernst said after she won. That slogan came from a TV commercial in which Ernst talked about castrating hogs during her childhood on an Iowa farm.

Tuesday was also a good night for Republicans in the House. The GOP expanded the majority it won in 2010 and was within reach of gaining its largest House advantage since the 1940s.

The voting ended a long, bitter and expensive election in which the dominant issue was the president. Just two years removed from a comfortable reelection, Obama has seen his image damaged by the bungled launch of his health-care program and by his reactions to crises overseas.

Republicans ran hard against him, while Democrats often ran from him. In Kentucky, McConnell’s opponent, Alison Lundergan Grimes, repeatedly and awkwardly refused to say even whether she had voted for Obama.

On Election Day, Obama seemed to anticipate bad news. He called four radio shows to talk about the midterms, including a Connecticut program in support of Gov. Dan Malloy’s struggling reelection bid against Republican Tom Foley.

In that call, the president said his party had faced an uphill battle because it had to defend Senate seats in a series of conservative states.

“This election cycle is probably the worst possible group of states for Democrats since Dwight Eisenhower,” he said. The comparison was to the 1958 midterms, in which Eisenhower’s Republican Party lost 13 Senate seats.

But preliminary exit polls also suggested that Obama had become a symbol of what he once ran against: Washington’s gridlock, and the inability of its leaders to move beyond partisan fighting.

Nearly 6 in 10 voters said they were “dissatisfied” or “angry” at the Obama administration, the polls showed. A similar proportion felt the same about GOP leaders in Congress.

“People see a Washington that isn’t working,” Republican National Committee Chairman ­Reince Priebus said Tuesday on MSNBC, “and the person at the head of it all is the president.”

That message trickled down to voters in faraway Alaska, where Phyllis Kruger, a 52-year-old real estate agent, campaigned Tuesday for Republican Senate candidate Dan Sullivan. She blamed Washington’s problems on Democrats, including Sen. Harry M. Reid (D-Nev.), who will lose his perch as majority leader.

“I don’t think we’re going to have any progress in Washington, D.C., the way it’s going with a lock hold with Harry Reid,” Kruger said. “Harry Reid needs to go. Harry Reid needs to go now.”

In the campaign’s last hours, Democrats were desperately trying to find votes in states across the country. In Colorado, two Democratic senators — Michael Bennet, who was not running, and Udall, who was — climbed on an actual stump to give stump speeches at Colorado State University.

Udall walked across the campus plaza, shaking hands and asking people if they voted. They walked into a student center and went up to two young women who had a ballot on their table.

“I’m Mark Udall,” he said to the women. One, engrossed in studying, literally jumped with surprise.

Bennet introduced himself and looked at the empty ballot.

“Go vote, for God’s sake,” Bennet said.

In Montana, Rep. Steve Daines (R) won the seat occupied by Sen. John Walsh (D). The race became a cakewalk after Walsh dropped out following reports that he plagiarized parts of a research paper needed for his master’s degree.

In South Dakota, former governor Mike Rounds (R) won the race to replace the retiring Sen. Tim Johnson (D). Rounds had faced two serious opponents — Democrat Rick Weiland and Larry Pressler, a Republican former congressman and senator running as an independent. But both faded in the last weeks of the race.

McConnell will almost certainly be chosen as the Senate’s majority leader, giving new power to a Washington veteran who has frustrated Democrats by maximizing the sway of the Senate minority — inducing Republicans to vote as a bloc and using the filibuster mechanisms that make the Senate grind, sputter and stop.

McConnell now faces a new challenge: how to make the Senate, and his majority, work.

As leader, McConnell will have to build coalitions out of a Republican caucus divided between moderates and fire-breathing conservatives such as Sen. Ted Cruz (R-Tex.), who has urged a confrontational approach with the White House. McConnell will also have to work with or around Senate Democrats, who will undoubtedly use McConnell’s own blocking tactics against him.

Beyond the House and Senate elections, there were races for governor in 36 states. In Pennsylvania, Tom Wolf (D) easily beat the incumbent, Gov. Tom Corbett (R). And in Florida, Republican Rick Scott held on to his seat, defeating Charlie Crist — a former Republican governor who had reinvented himself as a Democrat.

In Wisconsin, Gov. Scott Walker (R) also won reelection after a race that had threatened his prospects as a 2016 presidential contender.

In Maryland, the governor’s race had been Democrat Anthony G. Brown’s to lose — and he lost. The state’s new governor will be a little-known Republican businessman, Larry Hogan, who slammed the low-key Brown as a supporter of high taxes. That loss was more bad news for Democrats on a night when they had an ample supply of it already.

Katie Zezima in Fort Collins, Colo.; Sebastian Payne in Anchorage; and Jerry Markon and Robert Costa in Washington contributed to this report.