Just hours before the midnight deadline, Congress averted a government shutdown Wednesday night by approving a temporary spending bill that will keep federal agencies open through Dec. 11.

The Senate first approved the bill, which did not include a controversial provision to defund Planned Parenthood, by a 78-20 tally. The House of Representatives then passed the bill in a 277 to 151 vote, where 186 Democrats and 91 Republicans supported the bill, reports CNN. All 151 opponents were Republicans.

After the bill passed both branches of Congress, President Barack Obama signed the bill into before the deadline expired.

Although the stopgap spending measure will keep the government operating for the next few months, there is no guarantee that there won't be yet another shutdown threat come December.

"The bill before us would keep the government open and allow time for cooler heads to prevail," said Republican Senate Majority Leader Mitch McConnell, according to USA Today.

"As we go forward, we'll have some difficult choices to make," said Democratic Rep. Nancy Pelosi. "Let us take heed of the words of Pope Francis, who urged us to work together for the good of the people."

The legislation will keep funding the government through mid-December, giving Congress an additional 10 weeks to negotiate a more wide-ranging budget deal.

Despite making it to the president's desk just in the nick of time, White House press secretary Josh Earnest criticized Republicans for prolonging the process of passing a spending bill.

"The American people deserve better than last-minute, short-term legislating," he wrote in a statement, according to The New York Times. "There's no reason that we should deny American families and businesses the certainty and support they need by kicking the can down the road again."

On the other hand, 2016 Republican presidential candidate Ted Cruz slammed Republicans for not holding their ground and shutting down the government in order to defund Planned Parenthood.

"Today was a win for the Washington cartel, and another setback for the American people," said the Texas senator. "Republican leadership chose to abandon its constitutional power of the purse and to fund 100 percent of President Obama's failed agenda."