The Republican-controlled House of Representatives has voted to pass a budget deal to avert what would be the first US federal government shut down since 2019.
The deal, which passed by a vote of 366 -34 only six hours before a midnight deadline, must still be approved by the Democratic-controlled Senate before it can be signed into law by President Joe Biden.
Lawmakers earlier this week had successfully negotiated a deal to fund government agencies - but it fell apart after President-elect Donald Trump and tech billionaire Elon Musk called on Republicans to reject it.
This vote was the third attempt this week to get a deal through the House after a second funding measure - that one backed by Trump - failed on Thursday.
The 118-page "American Relief Act, 2025" that passed in the House on Friday strips out a debt-limit provision that Trump had demanded, which was a sticking point for Democrats and some Republican budget hawks in an earlier draft bill.
The deal also removes measures sought by Democrats in the first version of the bill, including the first pay raise for lawmakers since 2009, federal funds to rebuild a bridge that collapsed in Baltimore, healthcare reforms, and provisions aimed at preventing hotels and live event venues from deceptive advertising.
A total of 34 Republicans voted against the short-term funding bill while all Democrats in attendance were in favour.
Trump has not yet commented on the vote. A statement put out by the White House on behalf of Biden praises the deal.
Ahead of the vote, Democrats slammed the involvement of Mr Musk in the process, who they pointed out is an unelected billionaire.
Mr Musk, who Trump has tasked with cutting government spending in his future administration, had lobbied heavily against an earlier bill.
During floor debate, Republicans said they look forward to a "new era" when Trump takes office and Republicans take control of both chambers of Congress next month.
The wrangling over budget left Republican House Speaker Mike Johnson bruised amid criticism from members of his own party over his handling of the process.
"We are grateful that everyone stood together to do the right thing and having gotten this done now as the last order of business for the year, we are set up for a big and important new start in January," Johnson told reporters after Friday's vote.
He also said that he had spoken frequently to both Trump and Mr Musk during the negotiations.
Johnsons remarks came shortly after Mr Musk praised the Louisiana congressman's work on the budget in a post on X, the social media platform he owns.
"The Speaker did a good job here, given the circumstances," he posted. "It went from a bill that weighed pounds to a bill that weighed ounces."
The dramatic budget fight served as a preview of the tense legislative fights that could be in store next year, once Trump is in the White House.
Officials have warned that if there is no funding deal going into the holiday season, millions of federal employees would go without paycheques if the government shuts down.
There will be countless other ways a shut down would affect Americans - including by limiting assistance to aid-reliant farmers and people recovering from natural disasters.
The last government shutdown was during Trump's first term in 2019 after the Republican-controlled House of Representatives failed to come to an agreement on a new spending bill.
That shutdown lasted 35 days, and was the longest in US history.