The Senate voted Thursday to pass a massive $1.7 trillion government spending bill that will fund critical government operations across federal agencies and provide emergency aid for Ukraine and natural disaster relief. The House must next pass the measure as lawmakers race the clock to avert a shutdown at the end of the week. The expectation on Capitol Hill is that a shutdown will be avoided, but congressional leaders have little room for error with government funding set to expire at the end of the day Friday. Once the House passes the bill it will be sent to President Joe Biden to be signed into law. The final vote tally in the Senate was 68-29. In order to give enough time for the yearlong bill to be formally processed and sent to Biden sometime next week, the Senate cleared a bill by voice vote Thursday afternoon to extend the government funding deadline by one week, to December 30. The House is expected to approve the one-week extension Friday before it votes on the yearlong spending bill. Senators had a breakthrough in negotiations Thursday morning after the giant government funding bill stalled for days over a GOP amendment regarding the Trump-era immigration policy, Title 42, that could have sunk the entire $1.7 trillion legislation in the Democratic-controlled House. GOP Sen. Mike Lee of Utah insisted on getting a vote on his amendment to keep in place the immigration policy that allows migrants to be turned back at the border, in an effort to prevent the spread of Covid-19, which Republicans strongly support. Because Lee’s measure was expected to be set at a simple majority threshold, there was concern it would pass and be added to the government funding bill as several centrist Democrats back extending the policy – only for it to later be rejected in the House. In order to break the impasse, Sens. Kyrsten Sinema of Arizona and Jon Tester of Montana wrote an amendment in an attempt to give moderates an alternative way to vote in support of extending Title 42, which the administration and most Democrats want to rid of. Centrist senators like Tester, Sinema, and Sen. Joe Manchin of West Virginia, who might have voted for the GOP amendment, can now vote for the competing Democratic measure that demonstrates their support for the policy, easing a politically tough vote. As expected, both amendments did not pass. Lee’s amendment to extend the Trump-era immigration policy failed 47-50. The Democratic alternate version from Sinema-Tester went down 10-87. Senate leaders unveiled the $1.7 trillion yearlong funding bill early Tuesday morning – the product of lengthy negotiations between top congressional Democrats and Republicans. The Senate had hoped to vote first to approve the deal this week and then send it to the House for approval before government funding runs out on December 23. The massive spending bill for fiscal year 2023, known on Capitol Hill as an omnibus, provides $772.5 billion for non-defense, domestic programs and $858 billion in defense funding. It includes roughly $45 billion in emergency assistance to Ukraine and NATO allies and roughly $40 billion to respond to natural disasters like hurricanes, wildfires and flooding. Other key provisions in the bill include an overhaul of the 1887 Electoral Count Act aimed at making it harder to overturn a certified presidential election – the first legislative response to the US Capitol insurrection and then-President Donald Trump’s relentless pressure campaign to stay in power despite his 2020 loss. The spending bill also includes the Secure Act 2.0, a package aimed at making it easier to save for retirement, and a measure to ban TikTok from government devices. The legislative text of the package, which runs more than 4,000 pages, was released in the middle of the night – at around 1:30 a.m. ET on Tuesday – leaving little time for rank-and-file lawmakers, and the public, to review its contents before Congress plans to vote to pass it. In a divisive political environment where bipartisan action often does not happen without immense time pressure, it has become the norm in recent years on Capitol Hill to release massive funding bills at the eleventh-hour and then proceed to jam them through both chambers. That has led to criticism from some lawmakers who say the process is rushed and secretive and does not operate with the transparency it should. This story and headline have been updated with additional developments.