WASHINGTON – House Speaker John Boehner took to the podium on Thursday morning and declared with confidence that the $1.1 trillion spending bill to avoid a government shutdown was going to pass the House. For the next 10 hours, it looked like he was going to be proved dramatically, embarrassingly wrong. 

But Boehner eventually succeeded, ushering the bill through the House with bipartisan support.

It wasn’t an easy lift for the speaker. He has spent his entire tenure as speaker trying to find ways to pass important fiscal bills without angering the right wing of his party too dangerously, while still managing to get enough Democrats to ensure passage in both the House and the Senate. Boehner was forced to strike the same balance again on the cromnibus bill, but this time many Democrats tried to organize against the measure.

As the House headed home to end the 113th Congress, Boehner took with him a big win. He'd help negotiate a bill that had gained enough Democratic support for passage but was still considered a victory by Republicans -- accomplishing revisions to Wall Street regulations, increasing campaign donation limits and blocking a litany of administration regulations. And despite pushback from dissatisfied conservatives, the speaker hung tough and persuaded Republicans who were on the fence to stick with his plan. 

Boehner has spent most of this Congress struggling to keep civil war from breaking out among his own members. On Thursday, he was able to watch the war unfold on the other side of the political aisle. Instead of coming out of another spending fight bruised, with his own members unhappy for passing a bill they didn’t like, this time he came out the victor.

For much of Thursday, it looked like Boehner was in trouble. First, during a procedural vote on the spending bill, Republicans started to show signs of fracturing. Rule votes generally pass easily on party lines. But this one proved to be tricky, with Democrats holding strong in opposition and conservative Republicans breaking from their party to show their own distaste for the bill.

Boehner and the rest of his leadership team worked the floor during the vote. After more than 30 minutes of voting, Republicans were looking at a tied result. Boehner approached Rep. Justin Amash, R-Mich., who responded to the inaudible words of the speaker by shaking his head no.

Ultimately, Michigan Republican Rep. Kerry Bentivolio, who lost his bid for reelection, switched his vote to give Republicans enough to put the rule over the top.

But the episode was a sign of trouble: There likely wouldn't be enough Republican support for the bill (since even some who voted yes on the rules would vote no on the bill). And it wasn’t clear how many Democrats who opposed the rule would switch and support the legislation.

So with Democratic support uncertain, it looked like the whole bill was coming unhinged. The House recessed minutes before they were slated to vote.

Then Boehner got an unexpected ally: President Barack Obama. The White House endorsed the legislation, and started making phone calls to undecided Democrats.

At 5:30 p.m., the Democrat headed in to what would be a more-than-three-hour-long caucus meeting. White House Chief of Staff Denis McDonough spent more than an hour in the meeting, making the case that while the bill wasn’t perfect, Democrats needed to vote for it.

At about 9 p.m., when the House surprised observers and opted to just hold the vote, many assumed it was about to fail. Republicans were readying a plan B. 

But the bill passed. And this time it didn’t take a large push by Republican leadership to round up the votes on the floor. It moved smoothly to passage; only 67 Republicans opposed the bill and 57 Democrats supported it.

For Boehner, it was the delivery of his morning promise: “Today, I expect the House will pass a responsible bill to keep the government running.”

He was right.

Now he comes into the next Congress in a stronger position. By working with Democrats, who will have even less power in the new year, and finding an ally in Obama, Boehner accomplished several Republican goals. 

After the bill went through, however, he posted a series of tweets that took a challenging tone towards the president -- perhaps to make clear to conservatives that he's still their man, in case they had any lingering doubts.

Next time there is a fiscal fight -- and there will certainly be one -- he can point to the cromnibus as a reason for them to follow his lead.