WASHINGTON — The Senate passed a $1.3 trillion government spending deal early Friday that would fund federal operations through Sept. 30 and avert what would have been the third government shutdown this year.

The early morning vote sent the measure to President Donald Trump for his signature after the House approved the bill earlier in a 256-167 vote, only hours after the legislation was formally released.

Trump, however, threatened just hours later to veto the freshly passed measure, because it didn't adequately fund his desired border wall or help recipients of the DACA program his administration left in limbo — prompting renewed concerns of yet another government shutdown.

"I am considering a VETO of the Omnibus Spending Bill based on the fact that the 800,000 plus DACA recipients have been totally abandoned by the Democrats (not even mentioned in Bill) and the BORDER WALL, which is desperately needed for our National Defense, is not fully funded," Trump tweeted Friday morning.

The tweet marked just the latest possibility of a government shutdown. Last month, Sen. Rand Paul, R-Ky., caused the government to shut down as he filibustered the short-term spending bill under consideration at the time. On Thursday morning, he tweeted a photo of himself holding up the bill, and said: “Well here it is, all 2,232 budget-busting pages. The House already started votes on it. The Senate is expected to soon. No one has read it. Congress is broken. …"

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

House Speaker Paul Ryan, R-Wis., at the U.S. Capitol on Thursday. Shawn Thew / EPA

Paul backed down from stalling the legislation late Thursday after intense discussions with Senate leaders, allowing the vote to proceed. The measure eventually passed 65-32.

The release of the measure on Wednesday came after a days-long impasse over issues involving border security, an infrastructure project and gun-related provisions.

The bill includes a compromise on one of Trump's top priorities: a new border wall. Instead of allocating all of the wall funds that Trump had sought, the measure is slated to provide roughly $1.6 billion for physical barriers and technology along the U.S.-Mexico border. The White House had been pushing for $25 billion over a three-year period. The $1.6 billion amount only included $641 million for 33 miles of new border fencing in the Rio Grande Valley, not a concrete wall.

The bill would also bar federal funding to build a barrier or wall along the U.S.-Mexico border in the Santa Ana National Wildlife Refuge in Texas. NBC News correspondent Jacob Soboroff visited the refuge in January and reported that the Army Corps of Engineers had identified the area as being among the locations where it was the easiest to build the border wall. Sierra Club activist Jackelin Treviño told NBC that the Trump administration viewed the refuge as “low-hanging fruit” because the government already owns the land whereas 95 percent of the land in Texas is privately owned, Soboroff reported.

This deal doesn't address the Deferred Action for Childhood Arrivals (DACA) program — as Democrats had pressed for — which the Trump administration had announced last September would end, tasking Congress with coming up with a legislative solution.

The measure provides a backdoor for construction to begin on the Gateway Project, a new rail tunnel connecting New York and New Jersey, by making some of the federal funding that supporters wanted available through money appropriated for Amtrak and other accounts. As much as $541 million in funding would be available for the project this year, a Democratic aide said, with an extra $2.9 billion in grants also being made available. Trump had quietly threatened to veto the bill if it contained funding for Gateway, but Republican lawmakers who represent districts in the region had lobbied him to support the effort.

In the wake of the school shooting in Parkland, Florida, last month, the omnibus also wraps in provisions to improve state compliance with the national background check system for firearm purchases as well as funding for school safety programs.

Among the items that were excluded from the bill are an extension of Obamacare cost-sharing payments, legislation regarding sexual harassment reporting on Capitol Hill and legislation to protect Robert Mueller's position as special counsel overseeing the federal investigation into allegations the Trump campaign might have colluded with Russians seeking to interfere in the 2016 U.S. presidential election.

Rebecca Shabad reported from Washington. Alex Johnson reported from Los Angeles.