The House passed a last-minute bill to avoid a government shutdown Thursday night, sending it to the Senate, where it faces a much higher hurdle on the way to President Donald Trump's desk.

The Senate needs 60 votes in the affirmative to pass a spending bill. That poses a challenge as at least four Senate Republicans have said they will oppose the bill, and many more Democrats have committed to voting against it.

Majority House Republican leaders, for their part, had to keep nearly all of their members in line in order to approve the short-term spending legislation by a 230 to 197 margin. With Democrats putting up a nearly unified front against the measure, GOP lawmakers manged to clear a bill that would fund the government through Feb. 16.

Eleven Republicans opposed the legislation, while six Democrats supported it.

Some House conservatives earlier Thursday had threatened to oppose the latest in a string of short-term spending bills. By Thursday evening, the conservative House Freedom Caucus said most of its members would back the bill after chair Rep. Mark Meadows reached a deal with GOP leaders, solidifying Republican support.

Meadows also reportedly spoke with Trump about the importance of reaching an agreement before he met with Republican leadership.

The bill's path in the Senate appeared much more perilous. Earlier Thursday, two Senate Democratic aides told CNBC that Democrats had the votes to block the House's bill.

After Senate Democrats joined Republicans in voting to proceed to the bill Thursday night, progress stalled as lawmakers were faced with the prospect of the plan failing. Senate Minority Leader Chuck Schumer wanted to hold the doomed vote on Thursday night, but Republicans appeared to want to push it closer to Friday's deadline to put more pressure on Democrats.

On the Senate floor Thursday night, Majority Leader Mitch McConnell said Democrats were trying to hold the country "hostage" over a "non-imminent problem."

Schumer, in response, decried "complete disarray" on the Republican side. In turn, he argued for a bill that extended funding only for a few days, rather than a month, to give lawmakers more time to hash out a long-term plan.

In recent days, Democrats threatened to oppose another temporary spending bill and decried the lack of movement on a bipartisan package to protect hundreds of thousands of young undocumented immigrants. Earlier Thursday, House Minority Leader Nancy Pelosi, D-Calif., announced that her caucus would oppose the bill and called it a "bad idea" and "wrong."

Trump, meanwhile, backs the short-term funding plan. The White House clarified Trump's support after a morning tweet from the president added confusion to the GOP's plans to avert a shutdown.

Earlier in the day, both Trump and House Speaker Paul Ryan sought to put the burden on Senate Democrats to avoid a government shutdown.

"It's up to the Democrats" to keep the government running, Trump said.

Ryan continued the line of attack after the House passed the bill.

"Senator Schumer, do not shut down the federal government," the Wisconsin Republican said.

The Democrats facing the most political peril in the vote are those who are up for re-election this year in states Trump won, including Claire McCaskill of Missouri, Heidi Heitkamp of North Dakota, Joe Manchin of West Virginia and Joe Donnelly of Indiana.

If a shutdown were to occur, McConnell intends to keep the Senate in session over the weekend and force those Democrats to face a series of difficult votes, according to reports from Politico and NBC News.