Updated

President Trump signed a massive budget package Friday morning that lifts spending caps while funding the government through March 23, ending a brief shutdown after a tumultuous night on Capitol Hill.

On Twitter, the president touted the bill’s billions in additional military spending.

“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!” Trump tweeted.

The House sent the $400 billion deal to his desk after approving it in the pre-dawn hours, on a 240-186 vote. This followed objections from Democrats over the absence of any immigration component and from fiscal conservatives over the sheer level of spending.

Trump sought to address both camps on Twitter Friday, lamenting that the package contained "waste" in order to win Democratic votes -- while vowing to pursue talks on the Obama-era Deferred Action for Childhood Arrivals program. Trump plans to end that program, which protects illegal immigrants brought to the U.S. as children, next month unless Congress acts.

"Costs on non-military lines will never come down if we do not elect more Republicans in the 2018 Election, and beyond. This Bill is a BIG VICTORY for our Military, but much waste in order to get Dem votes. Fortunately, DACA not included in this Bill, negotiations to start now!" Trump tweeted.

The package itself includes a stopgap measure to keep the government running, while allowing $300 billion more for the military and other programs over two years. The agreement also adds $89 billion in overdue disaster aid for hurricane-slammed Texas, Florida and Puerto Rico, a politically charged increase in the government's borrowing cap and a grab bag of health and tax provisions.

Passage of the measure came over the opposition of Democratic leaders who demanded the promise of a vote to protect "Dreamer" immigrants.

But the bigger drama played out on the Senate side. A last-minute maneuver by Sen. Rand Paul, R-Ky., delayed consideration of the bipartisan budget package in that chamber past midnight.

The result: the government endured a short-term shutdown in the wee hours of the morning, though most would never feel its effects. It was the second shutdown this year, after a three-day freeze in January.

Paul, though, objected on fiscal conservative grounds that the plan irresponsibly busted through budget caps and would grow the deficit even more.

"I ran for office because I was very critical of President Obama's trillion-dollar deficits," the Kentucky senator said. "Now we have Republicans hand in hand with Democrats offering us trillion-dollar deficits. I can't in all honesty look the other way."

At one point, an exasperated Sen. Thom Tillis, R-N.C., took to the Senate floor to lambaste Paul for what Tillis described as "theater."

"You can make a point all you want, but points are forgotten," Tillis added. "There aren't a whole of history books about great points in the U.S. Senate."

As Paul stood firm, the Trump administration announced it was preparing for a "lapse" in appropriations, indicating a short shutdown. The Senate eventually approved the bill, followed by the House, after that shutdown technically started.

After signing the bill, Trump on Friday defended the extra spending on Twitter: "Without more Republicans in Congress, we were forced to increase spending on things we do not like or want in order to finally, after many years of depletion, take care of our Military. Sadly, we needed some Dem votes for passage. Must elect more Republicans in 2018 Election!"

Senate Minority Leader Chuck Schumer, D-N.Y., praised the plan in a statement shortly after the vote, writing that, "Funding for education, infrastructure, fighting drug abuse, and medical research will all, for the first time in years, get very significant increases, and we have placed Washington on a path to deliver more help to the middle class in the future.”

The House Freedom Caucus, the chamber’s fiscally conservative wing, also opposed the bill out of concerns that it would lead to more government spending.

“The … caucus opposes the deal to raise spending caps on discretionary spending by nearly $300 billion over two years,” the roughly 30-member group said Wednesday. “We support funding for our military, but growing the size of government by 13 percent adds to the swamp instead of draining it. This is not what the American people sent us here to do.”

Fox News' Chad Pergram, Alex Pappas, Joseph Weber and Samuel Chamberlain and The Associated Press contributed to this report.