The US House of Representatives finally agreed a $1.1tn budget shortly before the government was due to close down at midnight on Thursday, the BBC reports.
The Republican driven measure was taken to the wire and only given the go-ahead just hours before the potential closure. It was eventually passed by 219 votes to 206 after President Barack Obama encouraged Democrats to support the budget.
It will fund most of the government until September 2015, but some areas will only receive short-term funding.
Republicans won control of both the House and Senate in elections in November. On last night’s agreement, the Republicans’ House leader John Boehner said: “Thank you and Merry Christmas.”
In all some 57 Democrats voted for the bill, although many from the party were upset that the President had called for support of the Republican bill.
Democratic House leader Nancy Pelosi said she was “enormously disappointed” at the President’s decision.
Just over a year ago, in October 2013, the US government went into a temporary shutdown when the two houses of Congress could not agree on a new budget, leaving more than 700,000 employees on unpaid leave.