Senate Republicans negotiated through early Saturday morning to pass their sweeping, trillion-dollar tax reform bill, putting the GOP and President Trump on the threshold of a major legislative victory this year.

“This is a great day for the country,” Senate Majority Leader Mitch McConnell said at about 2 a.m., after the measure passed by the minimum, 51-vote majority. “We have an opportunity to make America more competitive and provide relief to the middle class.”

Tennessee Sen. Bob Corker was the lone Senate Republican to vote against the bill, joining the 48 Senate Democrats who voted nay.

The eleventh-hour vote-wrangling and related, last-minute changes were highlighted by hand-written, barely legible revisions in the margin of one page of the 478-page document, a situation that Democrats criticized on social media.

GOP senators will now meet in conference with their counterparts in the Republican-led House – which last month passed its tax reform bill – to negotiate a compromise bill for Trump to sign before year’s end.

"We are one step closer to delivering MASSIVE tax cuts for working families across America," the president tweeted soon after the vote. "Special thanks to @SenateMajLdr Mitch McConnell and Chairman @SenOrrinHatch for shepherding our bill through the Senate. Look forward to signing a final bill before Christmas!"

Trump is eager to score his first, major legislative victory after the Senate failed this summer to pass legislation to repeal and replace ObamaCare.

But both chambers still must agree on a final measure, which includes compromises on such issues as property tax deductions, with support for fiscal House conservatives still a challenge.

“I applaud my friends and colleagues in the Senate for completing step 2 of 3 in the process,” said North Carolina GOP Rep. Mark Meadows, chairman of the conservative House Freedom Caucus. “This job is not done. … Now is the moment in which both chambers must come together, work out our differences, and finish what we’ve begun."

In a second tweet on Saturday morning, Trump acknowledged the final congressional hurdle.

“Biggest Tax Bill and Tax Cuts in history just passed in the Senate,” he wrote. “Now these great Republicans will be going for final passage. Thank you to House and Senate Republicans for your hard work and commitment!”

Trump told reporters before leaving the White House for New York: "Now we go to conference. Something beautiful is going to come out of that fix."

The Senate 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.

The GOP views passage as crucial to retaining its House and Senate majorities in next year's elections.

Democrats derided the bill as Republicans’ 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.

The New York Democrat also said the last-minute bill changes shows "the Senate is descending to a new low of chicanery."

Still, Democrats 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.

The Associated Press contributed to this report.