Harrison Fields, White House principal deputy press secretary, said in a post on X that Trump signed the continuing resolution Saturday.
The bill largely keeps government funding at levels set during Joe Biden's presidency, though with changes.
It trims non-defence spending by about $US13 billion ($A21 billion) from the previous year and increases defence spending by about $US6 billion ($A9.5 billion), which are marginal changes when talking about a top line spending level of nearly $US1.7 ($A2.7) trillion.
The Senate cleared the legislation on Friday in a 54-46 party line vote, with 10 members of the Senate Democratic caucus helping the bill advance to passage despite opposition from within their party — most vocally from colleagues in the House, who exhorted them to reject the bill out of hand.
Senate Democrats argued for days over whether to force a shutdown, livid that Republicans in the House had drafted and passed the spending measure without their input.
Democrats said the legislation short-changes health care, housing and other priorities and gives Trump wide leeway to redirect federal spending even as his administration and the Department of Government Efficiency rapidly dismantle congressionally approved agencies and programs.
In the end, enough of the Democratic senators decided a government shutdown would be even worse than letting the funding bill pass.
Senate Democratic leader Chuck Schumer said a shutdown would have given the Trump administration the ability to deem whole agencies, programs and personnel non-essential, furloughing staff with no promise they would ever be re-hired.
"A shutdown will allow DOGE to shift into overdrive," Schumer said.
"Donald Trump and Elon Musk would be free to destroy vital government services at a much faster rate."
Passage of the funding bill through the House earlier in the week was a victory for Trump and House Speaker Mike Johnson, who managed to hold Republicans together and muscle the bill to passage without support from Democrats — something they've rarely been able to achieve in the past.