US lawmakers have passed a government spending package shortly before a midnight deadline, averting a partial government shutdown.
The Senate passed six bills totalling $459bn (£357bn) which funds nearly 30% of the government.
It faced opposition, however, from some Republicans who argued the measure did not do enough to cut federal spending.
Republicans also wanted the bills to include stronger measures to address immigration at the southern border.
The set of compromise bills passed the Senate by a vote of 75-22 on Friday, following hours of last minute debate.
The bipartisan deal was struck by House and Senate negotiators last week, one day after congressional lawmakers travelled to the White House to meet President Joe Biden.
If a deal had not been reached, roughly 20% of government departments, including agencies that oversee agriculture, transportation and veterans affairs, would have to temporarily close by 12:01 (05:01 GMT) on Saturday.
Other federal funding, including defence spending and homeland security and state department budgets, would have expired a week later. Past shutdowns have led to furloughs of government workers and the closure of national parks.
Republicans control the House by a slim majority, while Democrats hold the Senate by a single seat. Spending bills to keep the US government open require buy-in from both parties in order to advance through both chambers to the president’s desk for signature.
There have been 10 US government shutdowns or partial shutdowns over the past four decades.
A larger fight now looms ahead of a 22 March shutdown deadline.
Congress must now find a way to agree on a budget for the Department of Homeland Security, which oversees immigration – a contentious political issue, especially in an election year.
The Pentagon’s budget must also be decided before the deadline arrives in just two weeks.
“Today, we got the first half of the job done – passing a serious bipartisan package to fund key parts of our government,” said Democratic Washington state Senator Patty Murray, the chairwoman of the Senate Appropriations Committee.
“This isn’t the bill I would have written on my own, but this is a strong bipartisan package that sustains vital resources that matter in people’s lives.”