Congress has voted to pass a two-year budget, meaning the US’s second shutdown in three weeks could end before the working day begins.
The Senate and the House have passed the measures, but still need to be signed off by President Donald Trump.
Federal funding for government services expired at midnight on February 8, after the Senate missed a voting deadline.
The 650-page plan proposes an increase in spending, by about $300 billion, on defense and domestic services.
Senators struggled with last-minute objections from Republican Rand Paul, meaning they did not vote in time. The shutdown came within three weeks of the last one, as lawmakers wrangle over the spending plan and other political demands on either side.
The House approved the bill by 240 votes to 186. The Senate had passed it by 71 to 28 three hours earlier.
Paul Ryan said the bill was “a great victory for our men and women in uniform” as the military would get more resources.
The House Speaker said: “Ultimately, neither side got everything it wanted in this agreement, but we reached a bipartisan compromise that puts the safety and wellbeing of the American people first.”
While the spending bill’s funding for the Pentagon delighted the national security wing of the party, fiscal conservatives were concerned about ramifications for the nation’s debt.
The 650-page spending plan was only unveiled on February 8, so the finer details are still unclear.
White House legislative affairs director Marc Short said the package would increase spending by “just shy” of $300 billion.
The bill contains $165 billion of additional defense spending and $131 billion in domestic spending, including funding for healthcare, infrastructure and tackling the US opioid crisis, reports Reuters news agency.
The proposal would raise the US debt ceiling until March 2019.