WASHINGTON — After a temporary lapse in government funding that lasted through the night, Congress passed a pricey two-year spending deal early Friday that will also fund the government for an additional six weeks.

The government temporarily closed after Congress failed to pass a government funding bill before a midnight deadline due to the objections of one senator, shutting down non-essential government services.

In the end, a bipartisan cohort of lawmakers supported the $400 billion agreement. Shortly after 1:30 a.m. ET, the Senate voted, 71-28, to approve a two-year spending bill that would reopen the government, and the House passed it at 5:30 a.m. with the support of 240 members.

Trump tweeted Wednesday morning that he had signed the bill, officially ending the brief shutdown.

"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!" he wrote. He followed the post with a call for Republicans to increase their majority in the midterm election.

"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!" he tweeted.

Congress now has until March 23, the next funding deadline, to write the legislation to accompany the spending deal that will fund the government for the remainder of the fiscal year.

The overnight shutdown occurred because Sen. Rand Paul, R-Ky., used a procedural tactic to block the Senate from meeting its deadline.

To the ire of his colleagues, Paul protested the vote because of the large price tag of the two-year spending deal. The agreement is an attempt to end the repeated drama of short-term funding bills that have occupied Congress for much of the past five months. But it, too, was filled with drama until the end: Paul's stunt forced government agencies to begin shutting down for the second time this year.

"I can't, in all good honesty, in all good faith, just look the other way because my party is now complicit in the deficits. But really who's to blame? Both parties," Paul said on the Senate floor.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

In the House, the measure easily passed despite several days of outcry from Democrats over the Deferred Action for Childhood Arrivals immigration program, or DACA. But 73 Democrats supported the measure, including many from districts ravaged by hurricanes that would benefit from $90 billion in disaster aid.

"There's a considerable irony here that there's so many good things in the bill and yet there's an outstanding issue that's very stubborn," said Rep. Richard Neal, D-Mass., ranking member of the Appropriations Committee.

The spending deal was hammered out between the Republican and Democratic Senate leaders. It increases domestic spending by $131 billion and defense spending by $165 billion over the next two years and suspend the debt limit for one year — until well after the midterm elections.

What it doesn't address is DACA. Per an agreement to end the three-day government shutdown last month, the Senate will take up DACA next week. House Democrats sought a similar agreement from House Speaker Paul Ryan, R-Wisc., who insisted that he will bring up DACA legislation.

"To anyone who doubts my intention to solve this problem and bring up a DACA and immigration reform bill: Do not," Ryan said at a news conference Thursday. "We will bring a solution to the floor, one that the president will sign. We must pass this budget agreement first, though, so that we can get onto that. So please know that we are committed to getting this done."

But Ryan has not promised an open and neutral process that gives Democrats the opportunity to help craft the bill. And most notably, President Donald Trump's support for a bill is a litmus test Democrats can't accept.

"Sometimes I think the speaker thinks he is the speaker of the White House not the Speaker of the House of Representatives," Democratic leader Nancy Pelosi said just before the vote.

Rep. Luis Gutierrez, D-Ill., said it's time for Democrats to have "courage."

"Anyone who votes for the Senate budget deal is colluding with this president and this administration to deport Dreamers. It is as simple as that," Gutierrez said in a statement.

Fiscal conservative Republicans decried the price tag.

Rep. Jeb Hensarling, R-Texas., who is chair of the House Financial Services Committee and is retiring at the end of his term, called the bill "a monumental mistake and a sad day."

“With the passage of this spending package, I fear Republicans have ceded our moral authority to lead our nation away from eventual national insolvency. I cannot in good conscience support it," he said in a statement.

Rep. Mark Walker of North Carolina, chairman of the conservative Republican Study Committee, was one of 67 House Republicans, and 16 in the Senate, to vote against it.

"The more we read the text, the more surprises for green energy and some of those things that we’re adamantly against," Walker said.

Some Republicans are praising the proposed increase in military spending, while Democrats are hailing an increase in domestic spending, a tonic that was enough, along with the desire to avoid a another government shutdown, to garner enough votes. But it's wasn't an easy vote for many.

Sen. Tim Scott, R-S.C., struggled with his vote but supported it.

"I think the military spending is incredibly important — probably a once-in-a-lifetime increase from my perspective — but the pay-fors are challenging," Scott said, referring to about $100 billion of revenue-raising mechanisms.

One of those offsets would be to sell off 100 million barrels of the Strategic Petroleum Reserve from 2022 to 2027, which some House conservatives say should be saved for an emergency.

Sen. John Kennedy, R-La., voted against the measure, pointing to the major increases to the deficit. "Anybody in the Milky Way concerned about the deficit has to be worried about this bill," he told reporters.

There were enough sweeteners in the bill to entice enough members to support the measure's passage. The addition of disaster relief brought Sen. Ted Cruz, R-Texas, who often votes against spending bills, on board.

"This latest disaster relief bill is the next step in our state’s road to recovery," Cruz said in a statement. "And I am gratified that (Sen.) John Cornyn (R-Texas) and I have been able to build upon and improve the bill that was sent to us by the House of Representatives to give the state of Texas the resources it desperately needs."