Congress on Wednesday passed the most significant overhaul of the U.S. tax code in 30 years, delivering a landmark legislative victory to President Trump and the Republicans that had once seemed impossible for the fractured party.

The sweeping measure imprints a clear conservative vision on the tax code that will affect nearly every household and business. Corporations will see a massive tax cut, while most Americans will see temporary savings of various sizes. And in a move that may prove politically perilous, Republicans delivered the biggest gains to the wealthy.

The bill’s passage comes after Republicans had consolidated their hold in Washington but became entangled in a string of high-profile failures during their first year in power. This time, the GOP was able to hold together, driven in part by fear of ending the year without a single major legislative achievement.

The passage kicks off an intense period of uncertainty for consumers and businesses as both scramble to understand the changes and take advantage of the end of the calendar year to minimize tax bills. Some local governments said they were flooded with calls from homeowners seeking to pay their 2018 property taxes this year to avoid a cap on real estate tax deductions that will begin next year.

The legislation also will play a huge role in the coming campaigns for the 2018 midterm elections. Republicans hope their plan will set off a flurry of economic growth and win over a public that polls suggest is deeply skeptical. Democrats, meanwhile, plan to characterize the bill as a giveaway to the wealthy, in hopes that the message will help them retake Congress in November.

President Trump, flanked by Secretary of State Rex Tillerson, left, and Defense Secretary Jim Mattis, holds a Cabinet meeting Wednesday. (Jonathan Ernst/Reuters)

At the White House on Wednesday, Republicans were united in ways they haven’t been at any point during the Trump presidency, rebounding from internal divisions that plagued them when they sought to overhaul the nation’s health-care laws.

“We’re going to see something that’s going to be very special. We’re bringing the entrepreneur back into this country,” Trump said at the White House, flanked by dozens of Republicans. “We’re getting rid of all the knots and all the ties, and ultimately what does it mean? It means jobs, jobs, jobs.”

After a months-long effort that stalled several times, the final votes Wednesday and Tuesday night proceeded smoothly. Through cajoling, threats and concessions, Republican leaders had secured support from an overwhelming majority of their members. All but 12 House GOP members voted for the bill and zero Senate Republicans voted against it, enough to overcome Democrats’ unanimous opposition.

The core of the plan is a massive and permanent cut to the corporate tax, lowering the rate to 21 percent from 35 percent, but it also includes new tax breaks for other businesses and temporary cuts to individual income tax rates at all levels.

The bill also doubles what’s known as the “standard deduction,” which many middle-class and working-class Americans use to reduce their tax payments. It greatly expands a child tax credit, although families with higher incomes see more of the increase than those who make less. But it will reduce deductions that new home buyers can take for mortgage interest payments and will scale back deductions Americans can take for taxes paid to state and local governments.

The bill also reduces the estate tax, a levy on inheritances charged only to the wealthiest Americans. Under the bill, a couple could pass on up to $22 million in assets without the beneficiaries having to pay the tax. The plan also exempts more families from the alternative-minimum tax and repeals an ­alternative-minimum tax for corporations.

In furious floor speeches ahead of the votes, lawmakers previewed the coming struggle over the public’s perception of the measure that will continue through the midterm elections.

Republicans promised their plan would raise the fortunes of the middle class through rates cuts and an avalanche of economic growth, promising higher wages. Democrats cited nonpartisan analyses that found the bulk of the bill’s benefits go to corporations and the wealthy, accusing the GOP of an act of class welfare that will bust the federal budget while enriching corporations and billionaire donors.

“This bill is not centered on a middle-class tax cut,” Sen. Ron Wyden (D-Ore.) said. “The fleeting sugar high this plan offers some middle-class families is just a distraction from its giveaways to multinational corporations and powerful donors.”

Much of how the bill will ultimately affect the middle class depends on decisions that have not yet been made. In 2018, the vast majority of Americans would see their taxes go down.

In the bill’s later years, however, many of the individual tax cuts are set to expire, leaving a broad swath of Americans paying more than they do right now. Republicans promise that a future Congress will intervene to prevent that tax hike from happening, while Democrats have questioned why the GOP procured a permanent cut for corporations while subjecting the middle class to years of uncertainty.

Equally in dispute is the bill’s ultimate impact on the nation’s finances. Congress’s official tax scorekeeper found that the plan would add more than $1 trillion to the deficit over 10 years, even after economic growth is taken into account. That figure would climb sharply if the individual tax cuts are extended.

Republicans dispute that analysis, arguing that surging economic growth will reduce or even eliminate their plan’s impact on the deficit. Democrats, meanwhile, have accused the GOP of fiscal recklessness that will eventually be paid for on the backs of the middle class. In truth, tax experts say, the impact of the tax plan on the federal budget over 10 years is difficult to pinpoint because a tax cut of this scope has not been enacted in recent history.

Republicans were handed instant selling points Wednesday when AT&T and Comcast announced new $1,000 bonuses to a combined 300,000 employees. And Fifth Third Bancorp, a large Cincinnati lender, announced it would raise its minimum hourly wage to $15 an hour and give a one-time bonus of $1,000 to 13,500 employees because of the tax changes.

“This bill means more take-home pay,” Trump told reporters earlier. “It will be an incredible Christmas gift for hard-working Americans.”

Other companies, however, say they plan to use the new tax breaks to bump stock dividends or buy back shares, moves that would enrich executives but do little for the workers they employ.

Senior White House officials said Trump will probably wait until January to sign the tax bill into law to avoid immediately triggering a 2010 law known as “PAYGO,” or “pay-as-you-go.” The budget law requires spending cuts to Medicare and other programs if legislation is approved that’s projected to add to the deficit.

If Trump were to sign the tax bill into law before Congress adjourns in December, lawmakers could be forced to vote on the PAYGO waiver measure as soon as next month to prevent immediate spending cuts. That could amount to as much as $25 billion to Medicare throughout next year.

Signing the tax bill into law in January would probably defer such a spending cut until 2019, giving Congress almost a year to come up with a solution. The PAYGO rules can be waived if 60 senators vote in favor, but Republicans will control only 51 Senate seats next year, meaning they will need to cut a deal with Democrats to prevent the cuts to Medicare from going into effect.

The bill also extends beyond taxes and into health care by scrapping a central part of the Obama-era law known as the Affordable Care Act. The repeal of the financial penalty for not purchasing health insurance does not go into effect until 2019. Projections vary on how the mandate’s absence will affect the health-care system, but the Congressional Budget Office has estimated it will result in 13 million fewer people having health insurance after a decade.

Trump heralded this aspect of the bill Wednesday.

“When the individual mandate is being repealed, that means Obamacare is being repealed,” he said.

Many Democrats and Republicans have said this is not true, although the change would mark the most substantial GOP step so far in dismantling President Barack Obama’s signature law. All other aspects of the health-care law would remain intact, and some Republicans have said they want to pursue new legislation that would lessen the impact of repealing the individual mandate.