WASHINGTON—Republicans pushed a nearly $1.5 trillion tax bill through the Senate early Saturday after a burst of eleventh-hour horse trading, as a party starved all year for a major legislative triumph took a giant step toward giving President Donald Trump one of his top priorities by Christmas.

“Big bills are rarely popular. You remember how unpopular ‘Obamacare’ was when it passed?” Senate Majority Leader Mitch McConnell, R-Ky., said in an interview, shrugging off polls showing scant public enthusiasm for the measure. He said the legislation would prove to be “just what the country needs to get growing again.”

Trump hailed the bill’s passage on Twitter, thanking McConnell and Senate Finance Committee Chairman Orrin Hatch, R-Utah. “Look forward to signing a final bill before Christmas!” the president wrote.

Presiding over the Senate, Vice President Mike Pence announced the 51-49 vote to applause from Republicans. Sen. Bob Corker, R-Tenn., was the only lawmaker to cross party lines, joining the Democrats in opposition. The measure focuses its tax reductions on businesses and higher-earning individuals, gives more modest breaks to others and offers the boldest rewrite of the nation’s tax system since 1986.

Republicans touted the package as one that would benefit people of all incomes and ignite the economy. Even an official projection of a $1 trillion, 10-year flood of deeper budget deficits couldn’t dissuade GOP senators from rallying behind the bill.

“Obviously I’m kind of a dinosaur on the fiscal issues,” said Corker, who battled to keep the bill from worsening the government’s accumulated $20 trillion in IOUs.

The Republican-led House approved a similar bill last month in what has been a stunningly swift trip through Congress for complex legislation that impacts the breadth of American society. The two chambers will now try crafting a final compromise to send Trump.

After spending the year’s first nine months futilely trying to repeal President Barack Obama’s health care law, GOP leaders were determined to move the measure rapidly before opposition Democrats and lobbying groups that could blow it up. The party views passage as crucial to retaining its House and Senate majorities in next year’s elections.

Democrats derided the bill as a GOP gift to its wealthy and business backers at the expense of lower-earning people. They contrasted the bill’s permanent reduction in corporate income tax rates from 35 percent to 20 percent to smaller individual tax breaks that would end in 2026.

Congress’ nonpartisan Joint Committee on Taxation has said the bill’s reductions for many families would be modest and said by 2027, families earning under $75,000 would on average face higher, not lower, taxes.

The bill is “removed from the reality of what the American people need,” said Senate Minority Leader Chuck Schumer, D-N.Y. He criticized Republicans for releasing a revised, 479-page bill that no one can absorb shortly before the final vote, saying, “The Senate is descending to a new low of chicanery.”

“You really don’t read this kind of legislation,” Sen. Ron Johnson, R-Wis., told home-state reporters, who asked why the Senate was approving a bill some senators hadn’t read. He said lawmakers needed to study it and get feedback from affected groups.

Democrats took to the Senate floor and social media to mock one page that included changes scrawled in barely legible handwriting. Later, they won enough GOP support to kill a provision by Sen. Pat Toomey, R-Pa., that would have bestowed a tax break on conservative Hillsdale College in Michigan.

The bill hit rough waters after the Joint Taxation panel concluded it would worsen federal shortfalls by $1 trillion over a decade, even when factoring in economic growth that lower taxes would stimulate. Trump administration officials and many Republicans have insisted the bill would pay for itself by stimulating the economy. But the sour projections stiffened resistance from some deficit-averse Republicans.

But after bargaining that stretched into Friday, GOP leaders nailed down the support they needed in a chamber they control 52-48. Facing unyielding Democratic opposition, Republicans could lose no more than two GOP senators and prevail with a tie-breaking vote from Vice President Mike Pence, but ended up not needing it.

Leaders’ changes included helping millions of companies whose owners pay individual, not corporate, taxes on their profits by allowing deductions of 23 percent, up from 17.4 percent. That helped win over Wisconsin’s Johnson and Steve Daines of Montana.

People would be allowed to deduct up to $10,000 in property taxes, a demand of Sen. Susan Collins of Maine. That matched a House provision that chamber’s leaders included to keep some GOP votes from high-tax states like New York, New Jersey and California.

The changes added nearly $300 billion to the tax bill’s costs. To pay for that, leaders reduced the number of high-earners who must pay the alternative minimum tax, rather than completely erasing it. They also increased a one-time tax on profits U.S.-based corporations are holding overseas and would require firms to keep paying the business version of the alternative minimum tax.

Sen. Jeff Flake, R-Ariz.—who like Corker had been a holdout and has sharply attacked Trump’s capabilities as president—voted for the bill. He said he’d received commitments from party leaders and the administration “to work with me” to restore protections, dismantled by Trump, for young immigrants who arrived in the U.S. illegally as children. That seemed short of a pledge to actually revive the safeguards.

The Senate bill would drop the highest personal income tax rate from 39.6 percent to 38.5 percent. The estate tax levied on a few thousand of the nation’s largest inheritances would be narrowed to affect even fewer.

Deductions for state and local income taxes, moving expenses and other items would vanish, the standard deduction—used by most Americans—would nearly double to $12,000 for individuals and $24,000 for couples, and the per-child tax credit would grow.

The bill would abolish the “Obamacare” requirement that most people buy health coverage or face tax penalties. Industry experts say that would weaken the law by easing pressure on healthier people to buy coverage, and the nonpartisan Congressional Budget Office has said the move would push premiums higher and leave 13 million additional people uninsured.

Drilling would be allowed in the Arctic National Wildlife Refuge. Another provision, knocked out because it violated Senate budget rules, would have explicitly let parents buy tax-advantaged 529 college savings accounts for fetuses, a step they can already take but which anti-abortion forces wanted to inscribe into law. There were also breaks for the wine, beer and spirits industries, Alaska Natives and aircraft management firms.

Associated Press writers Andrew Taylor in Washington and Scott Bauer in Milwaukee contributed to this report.