The House speaker, Nancy Pelosi of California, was re-elected on Wednesday to lead the Democrats in the next Congress, despite her party’s loss of more than 60 seats and its majority control of the House in the midterm elections.

Officials said that Ms. Pelosi defeated Representative Heath Shuler of North Carolina in an internal party vote, 150 to 43. Mr. Shuler acknowledged before the vote that he had no chance of winning, but he wanted to give disgruntled Democrats a chance to register their opposition to Ms. Pelosi’s leadership anyway.

Earlier on Wednesday, the House Democrats defeated a motion to delay the leadership election by a vote of 129 to 68. The 68 votes for delay showed the fractures in the caucus over Ms. Pelosi’s continuing as the party’s leader. Representative Peter DeFazio of Oregon, one of those pushing for a delay, said he believed the vote sent a substantial message.

Representative Steny H. Hoyer of Maryland was expected to be re-elected as the No. 2 Democrat.

With a new Republican majority taking control of the House beginning in January, Ms. Pelosi will be the Democratic leader in the new Congress; Mr. Hoyer would become the party whip.

Meeting separately, the House Republicans chose John A. Boehner of Ohio to be their leader and the new speaker of the House, as expected.

In the midterm election campaign, Ms. Pelosi became something of a lightning rod for public anger over some of the sweeping and costly legislation passed during the past two years. Republican candidates frequently singled her out for attack in their campaigns. Many of the House Democrats who went down to defeat this month were moderates with ties to the speaker.

But it was precisely because of the sweeping defeat the Democrats suffered in the elections that Ms. Pelosi said she wanted to stay on as the caucus’s leader. In her letter to colleagues announcing that she intended to run for minority leader in the new Congress, she said she wanted to resist efforts by the new Republican majority to undo the signature legislative accomplishments of the past two years — overhauls of the health care system, financial regulation, Social Security and Medicare.

“Our consensus is that we go out there listening to the American people,” Ms. Pelosi told reporters Wednesday afternoon after the vote. “It’s about jobs, it’s about reducing the deficit and it’s about fighting for the middle class. I look forward to doing that with this great leadership team.”

Mr. Shuler, the former college quarterback who won his third term representing North Carolina’s 11th District and who publicly called on her to withdraw her name from the leadership election, said after the vote that it sent a message that concerns about Ms. Pelosi’s leadership went beyond a few conservative “Blue Dog” Democrats.

“It came out pretty much as we expected,” he told reporters, adding that “it wasn’t about winning the race, but it was about having a voice within our caucus.”

Ms. Pelosi became the first female speaker after Democrats gained a majority in the House in 2006. She has been a prolific fund-raiser, collecting more than $200 million for the party since joining the leadership in the House in 2002.