House Minority Leader Nancy Pelosi received an unlikely show of support from President Trump Wednesday in her bid for speaker of the House.

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

Mr. Trump emphasized at a press conference Wednesday afternoon at the White House that his tweet was not sarcastic.

Mrs. Pelosi won’t have an easy time reclaiming her speaker position, as many Democrats both incumbent and incoming either distanced themselves or were hesitant to embrace her leadership during the campaigns.

“I think I would be able to very easily supply her the votes,” Mr. Trump said, strengthening his offer to rally Republican support to her bid for speakership.

Mrs. Pelsoi did not want to talk much about the president’s endorsement or the speaker position, though she still pleaded her case as a “good negotiator.”

“I don’t think anyone deserves anything,” Mrs. Pelosi said in response to the president’s comments. “It’s not about what you have done. It’s about you can do.”

Mr. Trump spoke with Mrs. Pelosi Tuesday night to offer congratulations after it became clear her party would take back control of the House.

The president took a tougher tone toward Democrats in general Wednesday morning, threatening to fight back against new investigations.

Mrs. Pelosi said Tuesday night that she would not support moving to impeach Mr. Trump unless hard evidence comes out from the special counsel investigation. However, she pledged the Democrats would not back off from doing oversight on the administration.

“We certainly will honor our responsibility as oversight of the executive branch,” she told PBS.

The president’s endorsement was a complete reversal from his rhetoric at campaign rallies, where he regularly warned voters about Mrs. Pelosi’s “socialist” agenda.

“If you don’t want to be saying the words ‘Speaker of the House Pelosi’ for the next two years, get out and vote” for Republicans, Mr. Trump urged voters at his final rally Monday night in Missouri.

• Dave Boyer contributed to this report.