WASHINGTON — House Democratic leader Nancy Pelosi led her party to a resounding victory in the midterm elections, but she has one more race to win: her own.

The San Francisco congresswoman is a prohibitive favorite to retake the speakership, which she lost in 2010 to the Republican Tea Party wave. But a small group of Democratic lawmakers who think the party needs a change at the top is quietly organizing in hopes of blocking her path.

Pelosi’s allies are projecting confidence.

“This is the person that took us to the Super Bowl and won, so this is a magnificent victory and important one,” Rep. Anna Eshoo, D-Palo Alto, said Wednesday.

“She will win,” said Eshoo, who watched the returns with Pelosi on Tuesday night. “But it would be wrong for any of us to demand something of members that are coming in. It’s up to them. And Nancy Pelosi is the first one to have said that, as she was funding their campaigns for victory.”

Senior Democratic congressional aides also told The Chronicle that Pelosi was on track to be speaker, noting that she was the architect of the victory in terms of messaging, fundraising and focus, and that Republicans’ numerous attacks on her did nothing to stop that.

Pelosi raised nearly half the Democratic Congressional Campaign Committee’s $270 million for the 2018 cycle. She campaigned in 30 cities in October, including appearances for three candidates who flipped Republican-held seats Tuesday night.

Pelosi also got an endorsement from an unlikely source: President Trump.

“In all fairness, Nancy Pelosi deserves to be chosen Speaker of the House by the Democrats. If they give her a hard time, perhaps we will add some Republican votes. She has earned this great honor!” Trump tweeted Wednesday morning.

In all fairness, Nancy Pelosi deserves to be chosen Speaker of the House by the Democrats. If they give her a hard time, perhaps we will add some Republican votes. She has earned this great honor! — Donald J. Trump (@realDonaldTrump) November 7, 2018

He echoed that in a news conference later in the day, saying he genuinely meant it.

“A lot of people thought I was being sarcastic,” Trump said of his tweet. “I wasn’t. She deserved it. ... She worked very hard.”

Pelosi, for her part, has expressed confidence that she will be speaker. That didn’t change at a news conference she held Wednesday.

“I heard the president say I deserve to be the speaker,” she said. “I don’t think anybody deserves anything. It’s not about what you have done — it’s about what you can do. ... I think I’m the best person to go forward to unify, to negotiate.”

Then she added: “I’m not going to answer any more questions on that subject.”

Pelosi’s apparent momentum hasn’t stopped some Democrats from organizing against her. Several lawmakers have been challenging her leadership for years, and they see potential in new House members.

According to a list compiled by the Capitol Hill news outlet Roll Call, at least three newly elected Democrats have ruled out voting for Pelosi as speaker on the House floor, and another seven have signaled they might oppose her at least within the intra-party vote scheduled for Nov. 28. Two more have indicated they want new leadership, without specifying how they would vote on the San Francisco Democrat.

One Democratic member who is familiar with efforts to pick a speaker other than Pelosi, and who spoke on condition of anonymity to talk about sensitive discussions, said eight to 10 lawmakers were involved in conference calls Wednesday about what to do.

“There’s a lot of just conversations behind closed doors,” the member said, estimating that up to two dozen Democrats could ultimately break with Pelosi.

Much depends on the size of the Democratic majority. By late Wednesday, Democrats had locked down 223 seats and were leading in six more races. If those were to hold, it would give Democrats a majority with 11 seats to spare.

The speaker must be ratified on the House floor by a majority of those voting, meaning a simple majority of a candidate’s party is not enough. Anything more than 11 defections under this scenario would require Pelosi to win some Republican votes, which would be highly unlikely now matter how effusively Trump praised her.

But no clear candidate who could rival Pelosi has emerged. Her second and third in command say they’ll stay put.

“She has earned it,” No. 3 Democrat Rep. Jim Clyburn of South Carolina told CNN. “Nancy Pelosi has been a great speaker, I support her, and as long as she is in pursuit of the gavel, I’ll be in support of her.”

The No. 2 Democrat, Rep. Steny Hoyer of Maryland, is a longtime Pelosi ally who announced his intention to run for House majority leader, a job now held by Republican Rep. Kevin McCarthy of Bakersfield.

One Democratic lawmaker who expressed a willingness to consider someone besides Pelosi said there was no obvious alternative to her.

The effort to block Pelosi from serving as speaker “seems like a vanity exercise,” said the lawmaker, talking on condition of anonymity to speak candidly. “What frustrates me is, I don’t know what their plan is. Without having a candidate, it’s a pretty shallow exercise. They feel they have a group that won’t support her; that’s fine, but I don’t know what their plan is.”

It is possible that dissidents could try to extract concessions from Pelosi in private, such as commitments to bring in new leaders or rules changes.

Most members of the Problem Solvers Caucus, a bipartisan group of roughly four dozen lawmakers, have signed onto a proposal of House rules changes they say would “break the gridlock” and make the legislative process more open. They could form a voting bloc to push the package, though not all are returning in the next Congress.

Tal Kopan is The San Francisco Chronicle’s Washington correspondent. Email: tal.kopan@sfchronicle.com Twitter @talkopan