Vilified by lawmakers from both parties for months, the health-care industry this year appeared to face an existential threat to its business model.

But this week, pharmaceutical companies, hospitals, insurance companies and medical device manufacturers practically ran the table in Congress, winning hundreds of billions of dollars in tax breaks and other gifts through old-fashioned lobbying, re-exerting their political prowess.

“It’s the ‘no special interest left behind bill’ of 2019. That’s what it feels like this is,” said Andy Slavitt, a former health administrator who served in the Obama administration. “There’s no other explanation.”

Support came from virtually every corner of Congress.

A bipartisan push to curb the practice of surprise medical billing was delayed until next year, with Senate Minority Leader Charles E. Schumer (D-N.Y.) working behind the scenes to raise objections to the package, according to three people familiar with the talks who spoke on the condition of anonymity to share details of private negotiations.

A bipartisan bid to rein in prescription drug prices failed to advance, as Senate Finance Committee Chairman Charles E. Grassley (R-Iowa) blamed Senate Majority Leader Mitch McConnell (R-Ky.) for blocking the effort.

Pharmaceutical firms also won extended protections for select patents, as lawmakers tucked 17 words into Page 1,503 of a bill that critics allege could amount to billions more in profits for the industry.

And through a flurry of letters and targeted meetings with freshman House Democrats, the health-care industry ginned up broad support for repealing taxes that were central to the 2010 Affordable Care Act. Even House Speaker Nancy Pelosi (D-Calif.), one of the law’s architects, agreed to go along.

The success shows how formidable the health-care industry remains, able to overwhelm Democrats with well-honed talking points and splinter Republicans through a concerted push.

The unexpected victories could also serve as a wake-up call to political leaders who have vowed to completely upend the health-care system after the 2020 elections. It showed how the industry, even when it is targeted, can emerge politically and financially stronger.

The biggest wins came as part of a $1.4 trillion spending package, which was passed by the House on Tuesday and the Senate on Thursday.

The spending package permanently repeals three major taxes created to help fund former president Barack Obama’s Affordable Care Act: a tax, opposed by labor unions, on expensive health-care plans; a tax on medical device manufacturers; and a tax on health insurance companies, which have an influential lobby in Washington.

The taxes have been largely postponed by Congress since they were created as part of Obama­care, but they were never fully removed, in part because of the large impact such a change would have on the budget deficit. Repealing them is projected to cut tax revenue by about $375 billion over the next 10 years — roughly one-quarter of the estimated cost of the GOP tax bill when it was approved in 2017, according to the Committee for a Responsible Federal Budget, a nonpartisan group.

A coalition of unions and employers aggressively pushed for repeal of the tax on high-cost insurance plans, often referred to as the “Cadillac” tax. Critics of the tax argued it would raise health costs.

Health insurers, meanwhile, pushed back hard on a tax against their industry, arguing it would raise premiums.

Many Democrats agreed to gut the Cadillac tax because of union backing, but repealing the taxes on health insurers and medical device companies proved more difficult.

Medical device lobbyists had a plan, though.

They held one-on-one meetings with lawmakers, including freshman Democrats from districts won by President Trump. They encouraged governors to send letters to Congress. And they showered lawmakers with personal stories during briefings with patient groups, according to a person familiar with the effort, who spoke on the condition of anonymity to discuss the operation.

While Pelosi initially was reluctant to repeal the taxes, lobbyists said, there was eventually overwhelming bipartisan support for the measures. More than 20 of the roughly 40 Democrats who won House seats in districts won by Trump sponsored a bill to repeal the ACA’s medical device tax.

“As we made the case to members of Congress, people began to agree it’s just not good policy,” said Scott Whitaker, president and chief executive of AdvaMed, a medical technology trade association.

Another tax lobbyist, speaking on the condition of anonymity to describe private conversations, said Democratic lawmakers increasingly felt they were unlikely to ever fully implement the Obamacare taxes.

He characterized their sentiment as: “We should admit we are never going to count the calories. So let’s just eat the cookie.”

Sen. Dianne Feinstein (D-Calif.), who worked on the Affordable Care Act in 2010, said the tax cuts amounted to “dismembering” Obama’s health-care law.

Other provisions in the spending package broke in favor of private industry. Advocates for lower drug costs said one obscure provision would give a whole category of pharmaceuticals a longer period of market monopoly — a potential giveaway to drug companies worth untold billions of dollars, depending on what future drugs might be expected to take advantage of the provision.

Deep in the bill, one tiny adjustment deems “chemically synthesized polypeptides” to be biologic drugs. New biologic drugs get 12 years of market exclusivity, free from generic competition. That is seven more years those polypeptides would receive if they were approved under the rules for regular small-molecule drugs, such as pills.

Congress also decided not to take action against the pharmaceutical industry. A bipartisan plan from Grassley and Sen. Ron Wyden (D-Ore.) would cap drug price increases in Medicare at the rate of inflation, but it faced widespread opposition from Republican lawmakers, who said the legislation is akin to imposing price controls they have long abhorred.

The effort was backed by the White House, but McConnell told the administration he would not take it up because a majority of Republicans did not support it. McConnell has said the Senate is still “looking at doing something.”

Meanwhile, the hospital industry was working to fend off legislation that would prevent patients from receiving surprise medical bills, which occur when patients go to a hospital that is in their insurance network but are unknowingly treated by a doctor who is outside of it.

Top party leaders helped slow down the effort, however. On Dec. 6, two days before a bipartisan group of lawmakers announced an agreement to their efforts, Schumer called a key player in the negotiations — Sen. Patty Murray (D-Wash.), the top-ranking Democrat on the Senate Health Committee — to express his disapproval of the measure, which negotiators had been crafting since the spring, according to three people familiar with the conversation who spoke on the condition of anonymity to discuss private talks.

Several people close to the negotiations said it was widely believed that Schumer was acting on behalf of powerful New York hospital groups, who have donated at least $1 million this year to the Senate Democratic fundraising arm. A Murray aide said the senator supported the agreement but didn’t want to sign on to a news release until she had worked through concerns of other Democratic senators.

The effort was tangled in other issues, too, including a split between Democratic House chairmen over how to address the problem. House Ways and Means Committee Chairman Richard E. Neal (D-Mass.) has raised questions about the legislation. And McConnell had never promised to bring up surprise billing legislation for a vote and is loath to take up legislation that splits his party.

A Schumer spokesman said “this has nothing to do with political donations” and that the lawmaker “absolutely believes” in ending surprise medical billing, but was trying to avoid taking a step that would complicate legislation already enacted in New York. The spokesman also said Schumer recently called lawmakers involved in appropriations to say he would not stand in the way of a surprise billing agreement, and would “work hard to make sure” legislation is enacted next year.

Christopher Rowland contributed to this report.