President Trump and Congress have reached a tentative agreement on a $1.4 trillion spending plan that gives the White House flexibility to continue building border fencing, slashes unpopular ObamaCare taxes and boosts funding to military and domestic programs.

There seems to be something in it for everyone coming into a crucial election year and the accord is a far cry from the record-breaking partisan-driven government shutdown of a year ago.

Appearing to avoid a stand-off over border wall funding, the deal awards Trump with $1.4 billion to erect new barriers —the same as last year. But it preserves Trump’s flexibility to use his budget powers to tap other defense-related accounts in order to dramatically increase spending on border wall construction.

That was the trade-off for Democrats to win billions of dollars in increased spending on pet domestic projects.

“The President has limited authority to move funding within the Department of Defense to build border fence and to declare a national emergency and cancel military construction projects and redirect their funding,” said a spokesman for House Appropriations Committee Chairwoman Nita Lowey (D-Westchester).

A White House source confirmed the president’s flexibility under the deal to transfer Defense funds to aid wall funding and budget negotiators said that there was not really much fuss over the border funding issue this time around.

One change won plaudits from both labor unions and conservatives alike — repeal of the controversial health care taxes approved by former President Barack Obama and the Democratic-led congress in 2009.

The accord scraps the so-called 40 percent “Cadillac tax’’ on high cost insurance plans that, if implemented, would hit policies covering unionized government workers and the construction trades. Because of labor opposition, the tax was suspended and never implemented — and now repealed.

“Taxing good healthcare plans was an asinine idea to begin with and an absolute betrayal of the trade unions,” Transport Workers Union president John Samuelsen told The Post.

“It’s good that the tax is gone but the fact that Obama thought it was smart to subject workers to such a tax to begin with speaks volumes about the problems with centrist Democrats.”

The deal also scraps a 2.3 percent tax on medical devices.

The taxes, worth an estimated $40 billion a year, were designed to both generate revenue for the Affordable Care Act and prod health care providers to rein in excessive medical costs.

Meanwhile, the two budget bills boost military and domestic spending across the board.

Both the troops and federal civilian government workers will see a 3.1 percent bump in pay next year.

With terrorism still a concern, the spending package boosts counter-terrorism funding to New York City and other localities through the Urban Area Security Initiative by $25 million, from $640 million to $665 million. The funding is a top priority of Senate Minority Leader Chuck Schumer (D-NY).

The program was created after the 9/11 attacks to help thwart future terrorist attacks and earmarks funding to high-risk areas. Under it, the New York City metro area and Newark, NJ region have received a combined $3 billion since 2002.

In a victory for gun-control advocates, the budget provides a total of $25 million for the Centers for Disease Control and the National Institutes of Health to research deaths and injuries caused by firearms in the wake of a series of shooting massacres. The measure had been opposed in the past by gun rights activists.

Elsewhere, the budget increases medical research funding at the National Institute of Health by 7 percent, to $41.7 billion. That figure $200 million to develop universal flu vaccine .

There’s also $425 million set aside for election security grants, $7.6 billion to conduct the US Census as well as increases in spending for anti-poverty programs including Head Start.

The Democratic-led House will begin voting on budget bills Tuesday and the GOP-run Senate will follow suit later this week before Christmas recess.