Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WASHINGTON — The Senate passed a sweeping and contentious overhaul of the tax code early Saturday morning, moving one step closer to sending the bill to President Donald Trump’s desk for his signature.

The bill passed 51-49 along party lines with just one Republican, Sen. Bob Corker of Tennessee, voting against it.

The legislation would bring the first overhaul of the U.S. tax code in 31 years. It would slash the corporate tax rate, offer more modest cuts for families and individuals, and eliminate several popular deductions.

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

Democrats derided the reforms as a GOP gift to the party's wealthy and corporate backers at the expense of lower-earning people.

The bill is “removed from the reality of what the American people need,” said Senate Minority Leader Chuck Schumer of New York.

Trump and GOP lawmakers have repeatedly touted the bill as a boon for the middle class, despite several independent analyses that found it's skewed toward corporations and the wealthy. Two-thirds of middle-class earners would see tax increases, according to the nonpartisan Tax Policy Center.

A Joint Taxation Committee score Thursday found that even with the slight economic growth spurred by the bill, the tax cuts would still add $1 trillion to the deficit, and Senate rules foiled the addition of a "trigger" mechanism that would have hiked taxes should economic growth fall short.

The tax bill also repeals the individual mandate, a key part of former President Barack Obama's health care law, as well as the tax credits that help low-income Americans pay for insurance.

The Senate bill must now be reconciled with the House version so that the same bill is passed out of both chambers.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The White House has been pushing hard to accomplish a tax overhaul before Christmas in order to give the president a much-needed first year win after a number of failed attempts to repeal and replace Obamacare.

Trump tweeted again early Saturday to emphasize his delight.

Biggest Tax Bill and Tax Cuts in history just passed in the Senate. Now these great Republicans will be going for final passage. Thank you to House and Senate Republicans for your hard work and commitment! — Donald J. Trump (@realDonaldTrump) December 2, 2017

He also told reporters Saturday morning from the White House's South Lawn that after a "fantastic evening ... now we go on to conference and something beautiful is going to come out of that mixer."

"People are going to be very, very happy," he said before leaving Washington for a series of fund-raising events in New York City. "They're going to get tremendous, tremendous tax cuts and tax relief, and that's what this country needs."

The bill's passage also gives Senate Republicans a major victory in a year in which they've been unable to deliver on any other major piece of legislation.

GOP leaders secured enough votes Friday after fits-and-starts by accommodating the demands of a handful of members with concern about the bill.

A series of last-minute changes were made to the bill, including a $10,000 property tax deduction to appease the concerns of Sen. Susan Collins of Maine.

On Friday evening, a motion by Schumer to adjourn the vote until Monday — to give senators more time to read the bill, which was riddled with handwritten notes — was voted down along party lines, 48-52.

“The Senate is descending to a new low of chicanery,” Schumer said.

UPDATE: Senate Republicans are so desperate to pass their tax bill tonight that they're now making handwritten changes to their already handwritten changes...



Seriously. pic.twitter.com/KQfW7bOyk1 — Senator Dick Durbin (@SenatorDurbin) December 2, 2017

After its middle-of-the-night passage just before 2 a.m., McConnell pushed back at claims that lawmakers didn't have enough time to look at the legislation.

“Democrats had plenty of notice," said the senior senator from Kentucky. "Everybody had plenty of opportunity to see the measure, you complain about process when you're losing, and that’s what you heard on the floor tonight.”

He said he expects the bill to be a “revenue producer bill that’s going to get America moving again.”

“Big bills are rarely popular. You remember how unpopular ‘Obamacare’ was when it passed?” said McConnell, shrugging off polls showing scant public enthusiasm for the measure.

McConnell announced earlier Friday that Republicans had the votes to pass the GOP tax bill, after one holdout, Sen. Jeff Flake, said he would support the measure.

Moments later, Flake, an Arizona Republican who is not running for re-election next year, issued a statement saying that the bill, which had been revised numerous times, now met his "objectives."

Among other things, Flake said he was pleased that he had now received a commitment on legislation that would protect DACA recipients.

In getting to "yes," Flake and Collins joined Sen. Ron Johnson, R-Wis., who earlier Friday rallied behind the tax legislation.

Johnson's "yes" came after the bill was altered to address his concerns on the small-business tax, known as pass-throughs.

Related: Senators’ pet projects added at last-minute into tax bill

Corker, however, said Friday afternoon that he would not support the bill, citing his remaining concerns over its impact on the deficit.

"I wanted to get to yes. But at the end of the day, I am not able to cast aside my fiscal concerns and vote for legislation that I believe, based on the information I currently have, could deepen the debt burden on future generations," he said in a statement

The Senate voted, 52-48, to strike an amendment by Sen. Pat Toomey, R-Pa., from the bill that would have carved out a tax break for Hillsdale College, a small school in Michigan that is supported by top Republican donors, including Education Secretary Betsy DeVos and Chris Chocola, a former president of the conservative group Club for Growth who used to serve in the U.S. House from Indiana.

CORRECTION (Dec. 2, 2017, 12:10 p.m., ET) An earlier version of this article misidentified Chris Chocola. He is a former president of Club for Growth, not the current president.