Hours before government was due to shut down at midnight on Thursday, December 11, the House has passed the US $1.1 trillion budget.
The Republican measure was passed by 219 votes to 206 after President Barack Obama had urged Democrats to support the budget.
The new budget will fund most of the government until September 2015, but some areas will only receive short-term funding.
Republicans won control of both House and Senate in elections in November.
A relieved John Boehner, the Republicans’ House leader, said: “Thank you and Merry Christmas.”
Fifty-seven Democrats voted for the bill, but others were angry about Barack Obama’s call for support of the Republican bill, with Democratic House leader Nancy Pelosi saying she was “enormously disappointed” at the president’s position.
The Republicans strongly oppose Barack Obama’s immigration reforms and so the bill only funds the Department of Homeland Security until February.
The budget bill must now be passed by the Senate and sent to the president to sign into law.
A two-day extension of government funding was approved by the Senate on Thursday to give it time to pass the main budget.
Senate Majority leader Harry Reid said that his chamber would begin looking at the legislation on December 12.
The bill funds the government at the same levels that were negotiated last December.
It also adds emergency funding requested by Barack Obama, including funds to fight Ebola in West Africa and money for US air strikes against militant group Islamic State in Iraq and Syria.
A number of Democrats were unhappy at what they saw as unnecessary concessions made to Republicans in order to pass the bill.
“We don’t like lobbying that is being done by the president or anybody else that allows us to… give a big gift to Wall Street,” Democrat congresswoman Maxine Waters said.
For their part, several Republicans argued that the deal did not go far enough in putting curbs on President Barack Obama’s plan to grant work visas to millions of workers who had entered the US illegally.
The US government entered a partial shutdown during October 2013, after the two houses of Congress failed to agree a new budget.
That shutdown left more than 700,000 employees on unpaid leave and closed national parks, tourist sites and government websites.
The 1,600-page bill also includes a number of provisions intended to gain votes from both parties:
- increasing the amount an individual person can contribute to a national political party from $32,400 to $324,000
- blocking the District of Columbia from using its own funds to set up regulatory systems for marijuana legalization
- measures that would significantly weaken financial regulations in the Dodd-Frank law, including restrictions on derivatives trading
- blocking certain Environmental Protection Agency (EPA) regulations
- cuts in the budgets of the EPA and the IRS
- increases in the budget for Wall Street regulation agencies, including the Securities and Exchange Commission.[youtube OeKSPt3DIrE 650]