WASHINGTON — Going toe to toe with President Trump in the Oval Office may have finally crushed the Democratic rebellion against Nancy Pelosi becoming House speaker.

“I think it definitely puts her over the line. The rebels are negotiating to save face at this point,” one Democratic House aide told The Post.

On Tuesday, Pelosi joined Senate Democratic leader Chuck Schumer for a combative, 17-minute stand-off with Trump as the cameras rolled.

She informed the president that he didn’t have the votes for his border wall and called a potential government closure a “Trump shutdown.”

“Gal Gadot is great, but the original Wonder Woman is back,” tweeted Democratic National Committee Chair Tom Perez, posting a picture of Pelosi walking out of the meeting wearing a pair of sunglasses.

Rep. Sheila Jackson Lee (D-Texas) tweeted her favorite Pelosi quote from the contentious meeting.

And by Tuesday night, Pelosi and rebel Democrats were close to a deal, according to Politico.

The deal would limit Democratic leadership to three terms. And if a member wanted to extend their leadership, they would need a two-thirds majority vote from the Democratic caucus.

The agreement would be retroactive, meaning that the three top Democrats — Pelosi, House Minority Whip Steny Hoyer (D-Md.) and assistant Democratic leader Jim Clyburn (D-S.C.) — would be entering their third terms in January 2019.

After January 2021, they’d need the two-thirds caucus vote to stay in place, Politico said.

Pelosi won the Democratic caucus vote for speaker last month, though 32 Democrats voted against her.

She can only afford to lose 17 when the vote goes to the full House next month.