Washington — The Senate has voted to advance a $1.4 trillion government spending package in a last, bipartisan burst of legislating before bolting for the holidays from a Capitol that's toxic with impeachment. The vote in the Senate comes the day after the House voted to impeach President Trump for abuse of power and obstruction of Congress.

The first bill in the two-bill package, covering domestic programs, passed easily Thursday by a 71 to 23 vote, with a vote on a Pentagon and homeland security measure to come later in the day. The second bill passed with even more support, 81 to 11.

The legislation gives Mr. Trump a victory on his U.S.-Mexico border fence and gives Democrats long-sought domestic spending increases and a repeal of Obama-era taxes on high-cost health insurance plans. It blends spending increases for both sides — reelection fodder for lawmakers throughout the Capitol — with tax and benefit add-ons that will add roughly $400 billion to the deficit over 10 years.

Get Breaking News Delivered to Your Inbox

The compromise bill would forestall a government shutdown this weekend, and the White House has announced Mr. Trump will sign it before Friday's midnight deadline.

The split-their-differences legislation is towing an unusually large haul of unrelated provisions into law, prompting futile protest from fiscal conservatives. It implements a summertime spending deal that reversed unpopular and unworkable automatic spending cuts to defense and domestic programs — at a $2.2 trillion cost over the coming decade.

"These spending bills are a fiscal dumpster fire," said Senator Mike Lee, Republican from Utah. "This is embarrassing."

Key provisions include an expensive repeal of Obama-era taxes on high-cost health plans, help for retired coal miners, and an increase from 18 to 21 in the nationwide legal age to buy tobacco products muscled into the measure by Majority Leader Mitch McConnell.

The almost 2,400-page package reflects the reality of divided government and the enduring strength of the Capitol's appropriations process, which allows members to go to bat for their states and congressional districts. McConnell emerged as a victor, winning the politically popular $6 billion pension rescue for about 100,000 retired coal miners, along with more parochial items like help for his state's legal hemp industry and $410 million to build a new veterans hospital in Louisville.

The Senate side of the Capitol is seen on the morning after the House of Representatives voted to impeach President Trump for abuse of power and obstruction of Congress on Thursday, December 19, 2019. J. Scott Applewhite / AP

The measure securing health care and pension benefits for retired coal miners was a provision championed by Senator Joe Manchin, a Democrat from West Virginia. Mr. Trump has often touted his support for coal miners, making this a bipartisan provision.

House Speaker Nancy Pelosi was also a driving force, winning permanent repeal of a tax on high-cost "Cadillac" health insurance benefits that is unpopular with Democratic labor allies.

Democrats have cheered several of their priorities in the mammoth legislation, including $25 million for gun violence research — the first time money has been provided for this kind of research in more than two decades — and $425 million for election security grants.

McConnell, Pelosi and key deputies such as the veteran, pragmatic chairs of the Appropriations Committee have wrestled over the spending package for months, finally cutting a deal on Monday that gives Trump a steady stream of funding for his long-sought border wall.

"I would have preferred no funding for the wall," said top Appropriations Committee Democrat Patrick Leahy of Vermont. "But the Republicans were clear. ... They stood with the president on the wall, as they seem to do time after time."

The bill also offers business-friendly provisions on export financing, flood insurance and immigrant workers. A tax on medical devices and health insurance plans would also be repealed permanently.

The core of the spending bill is formed by the 12 annual agency appropriations bills passed by Congress each year. It fills in the details of a bipartisan framework from July that delivered about $100 billion in agency spending increases over the coming two years instead of automatic spending cuts that would have sharply slashed the Pentagon and domestic agencies.

The sprawling appropriations bill exceeds Mr. Trump's budget requests in virtually every domestic category save for Mr. Trump's request for $8 billion-plus for the U.S.-Mexico wall, which was cut back to $1.4 billion, equal to last year's appropriation — while preserving Trump's ability to use his budget powers to tap other accounts for several times that amount. That's a blow for liberal opponents of the wall but an acceptable trade-off for pragmatic-minded Democrats who wanted to gain $27 billion in increases for domestic programs.

But the Democratic cave-in to Mr. Trump on the wall angered some Hispanic lawmakers — who lashed out at House Appropriations Committee Chairwoman Nita Lowey rather than Pelosi.

"I told (Lowey) we don't appreciate that we're going to get thrown under the bus so she can pass this omnibus and she did exactly that," said Congressman Ruben Gallego.

The trade-off for the wall money is Mr. Trump's signature on the broader package, which increases spending across the almost one-third of the budget that's passed by Congress each year. Popular bipartisan programs like health research, veterans medical care, NASA, sewer and water projects, and law enforcement grants to states and local governments would get increases, while the $738 billion Pentagon budget is a new record with increases for procurement of expensive weapons systems like the F-35 fighter.

The increase in the tobacco purchasing age to 21 also applies to e-cigarettes and vaping devices. Aides familiar with the talks said Pelosi agreed to the tobacco legislation — supported by big tobacco interests like Altria — as she also won an arcane carve-out to help unionized carpenters with lower drug costs under their health plans. Her office did not immediately respond to a request for comment.

But anti-smoking activists were irate at the so-called T-21 provision, saying it doesn't go far enough because it failed to ban flavored vaping products popular with teenagers. It also threatens to kill momentum for more stringent anti-vaping legislation backed by House Energy and Commerce Chairman Frank Pallone who was one of only seven Democrats to oppose the domestic spending half of the two-bill package.

Business groups also praised a seven-year extension of the charter of the Export-Import Bank, which helps finance transactions benefiting U.S. exporters, as well as a renewal of the government's terrorism risk insurance program. The financially troubled government flood insurance program would be extended through September, as would several visa programs for both skilled and seasonal workers.

While Republicans touted defense hikes and Democrats reeled off numerous increases for domestic programs, most of the provisions of the spending bill enjoy bipartisan support, including increases for medical research, combating the opioid epidemic, Head Start and child care grants to states.

Democrats also secured $425 million for states to upgrade their election systems, and they boosted the U.S. Census budget $1.4 billion above Trump's request. They won smaller increases for the Environmental Protection Agency, renewable energy programs and affordable housing.

"These bills accommodate countless Member priorities on both sides of the aisle," said GOP Appropriations Committee Chairman Richard Shelby, who won many items for his home state of Alabama.