The US Senate has approved a $1.2tn spending package that will fund the US government through September.
With just minutes to go before a midnight deadline, lawmakers averted a partial government shutdown.
The deal means there will be no disruption to funding for key government departments, although votes on a series of amendments are expected to last for several hours.
President Joe Biden should be ready to sign on Saturday.
Democratic Senate Majority Leader Chuck Schumer said it won't be easy, but “our persistence is worth it.”
“It's good for the American people to reach a bipartisan deal to finish the job,” he said on the Senate floor.
The legislation would end months of fighting between the two main parties.
The White House said early Saturday that the U.S. Office of Management and Budget has halted shutdown preparations because it hopes Congress will quickly pass the bill and President Biden will sign it into law.
The bill has already passed the House of Representatives with a final vote of 286 to 134 — well short of the required two-thirds majority. All but 23 Democrats supported the legislation, while 112 Republicans voted no.
A small but vocal group of conservatives opposed the proposed increase in government spending and called for new legislation that would include changes to US immigration laws aimed at addressing the surge of undocumented immigrants at the US southern border.
Congresswoman Marjorie Taylor Green of Georgia filed a petition to force the election of a new House Speaker, replacing Mike Johnson of Louisiana, who supported the package.
Friday's House budget vote continues a trend of recent government-funding fights where Democrats have joined some Republicans in approving legislation to avoid a shutdown.
However, unlike recent votes, a majority of House Republicans opposed a funding bill negotiated by their own party.