The US House of Representatives has narrowly passed a $1.1 trillion spending bill to avert a government shutdown less than three hours before a midnight deadline.
The bill will let the majority of government programmes operate through to the end of the current fiscal year ending September 30, 2015.
The vote late on Thursday was narrowly in favour with 219 House representatives approving the bill, while 206 voted against.
Shortly after the vote, the House and Senate passed in separate meetings a 48-hour extension of funding to keep government offices open while the Senate considers the broader measure.
Senate Democratic leader Harry Reid said the Senate would begin that debate on Friday. Both houses of the US Congress should approve the budget before the president signs it into force.
The spending bill was nearly killed earlier on Thursday by a revolt among Democrats over provisions to roll back part of the Dodd-Frank financial reform law and allow more big money political donations.
However, President Barack Obama and his administration waged a last-ditch campaign to persuade Democrats to set aside their objections, arguing that if it failed, the party would get a worse spending deal next year when Republicans take control of the Senate and have a stronger House majority.
Leaders work together
The effort to save the bill marked a rare moment of teamwork between Obama and House Speaker John Boehner, who simultaneously worked to persuade conservative Republicans to support it, Reuters news agency said.
In the end, 67 Republicans voted against the measure, largely because it failed to take action to stop Obama's executive immigration order. However, that was offset by 57 Democrats who voted in favour.
The 1,603-page measure, negotiated by Republican and Democratic appropriators and leaders, drew Democrats' ire when they discovered it would kill planned restrictions on derivatives trading by large banks, allowing them to continue trading swaps and futures in units that benefit from federal deposit insurance and Federal Reserve loans.
If passed by the Senate, the spending bill would provide the Department of Homeland Security with funds through February. 27.
Republicans intend to deny funding to the agency to carry out Obama's order allowing millions of undocumented immigrants to stay and work in the US.