President Donald Trump has signed a sweeping budget bill approved by Congress to re-open the government after it was briefly closed overnight.
Federal funding for government services expired at midnight (05:00 GMT), after the Senate missed a voting deadline.
The 650-page plan proposes an increase in spending on defence and domestic services of about $300bn (£215bn).
The shutdown, which lasted five hours, was the second under the Republican-controlled Congress this year.
The president, who signed the bill early on Friday, said the military "will now be stronger than ever before".
Just signed Bill. Our Military will now be stronger than ever before. We love and need our Military and gave them everything — and more. First time this has happened in a long time. Also means JOBS, JOBS, JOBS!— Donald J. Trump (@realDonaldTrump) February 9, 2018
The bill had been expected to pass before the midnight deadline but lawmakers struggled with last-minute objections from Republican Senator Rand Paul, which meant they could not vote in time.
The shutdown came within three weeks of the last one. Lawmakers have wrangled over the spending plan and other political demands from either side.
The House approved the bill by 240 votes to 186. The Senate had passed it by 71 to 28 three hours earlier.
House Speaker Paul Ryan, a top Republican, said the bill was "a great victory for our men and women in uniform" as the military would get more resources.
He 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."
Politicians from both opposing parties criticised Senator Paul for slowing the bill up and provoking the shutdown.
Democratic Senator Claire McCaskill said "it looked like he was clueless", while Republican Senator John Thune called the shutdown "a colossal waste of time".
Why were budget hawks opposed to the bill?
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.
In a doom-laden speech, Senator Paul angrily charged his fellow Republicans with fiscal profligacy, accusing his colleagues of "spending us into oblivion".
"I ran for office because I was very critical of President Obama's trillion-dollar deficits," he said.
"Now we have Republicans, hand-in-hand with Democrats, offering us trillion-dollar deficits.
"I can't in all good honesty, in all good faith, just look the other way just because my party is now complicit in the deficits."
This would be "the very definition of hypocrisy", he added.
What's in this bill?
The two-year budget deal, proposed by Senate leaders on Wednesday, increases spending by "just shy" of $300bn, according to White House legislative affairs director Marc Short.
The Washington Post put the figure at half a trillion dollars.
The bill contains $165bn of additional defence spending and $131bn in domestic spending, including funding for healthcare, infrastructure and tackling the US opioid crisis, reports Reuters news agency.
The bipartisan agreement also keeps the government open until March 23, giving lawmakers more time to draft a full-year budget to fund federal agencies.
The proposal would raise the US debt ceiling until March 2019.
Why were some Democrats unhappy?
Despite the support of their Senate leader Chuck Schumer, who said the budget accord will "break the long cycle of spending crises", some Democrats have complained that the bill does not address immigration.
The party's leader in the House of Representatives, Nancy Pelosi, said on Thursday morning that she was opposed to the plan, but would not order rank-and-file Democrats to vote against it.
The California congresswoman called for the bill to include a provision shielding so-called Dreamers, young immigrants who entered the US illegally as children, from deportation.
Her remarks came a day after she told the stories of immigrants for eight hours on the floor of the lower chamber in a record-breaking speech.
Obama-era guarantees for those immigrants were cancelled by US President Donald Trump and are set to become invalid next month.
Illinois representative Luis Gutierrez, one of the leading congressional advocates for immigrants, urged colleagues to vote against the plan.
"Don't collude with this administration," he said.
What would a shutdown have meant for ordinary people?
Many government agencies close during a shutdown as their future funding is theoretically not secure. Many employees are asked not to come to work and will not be paid - although some get back pay.
Employees deemed essential - including military personnel and air traffic controllers - are required to work regardless of shutdowns.
It was unclear which agencies would close on Friday if the shutdown continued into the working day.
Some Twitter users shared stories of how the uncertainty was affecting people.
I was leaving the building and met a woman who cleans offices in the capitol. She came at 1 am to start her shift and was sent home without pay because of the shutdown. She was planning to buy a car today and is unsure what to do. A solemn reminder that this isn’t a game.— Brian Schatz (@brianschatz) February 9, 2018
But for those of you wondering how do these impact Govt workers—for ppl like me they are obnoxious. For new Govt workers & lower wage Govt that have student loan debt, no savings, and rely paycheck to paycheck etc—these shutdowns are scary as hell— BiRevgal (@BiRevgal) February 8, 2018