WASHINGTON — Senate Republicans, after a flurry of last-minute deals, appeared to have salvaged their tax plan late Friday night, putting Congress on track to deliver President Donald Trump's most significant first-year accomplishment.

The ambitious package, opposed by Democrats as a giveaway to the wealthy that will pile on the national debt, challenges GOP orthodoxy against deficit spending. Even after accounting for future economic growth, the plan is estimated to add $1 trillion to the deficit over 10 years, rebuking Republican promises that the tax cuts will pay for themselves.

Still, only one Republican, Sen. Bob Corker of Tennessee, had publicly come out against the bill by Friday evening. The Senate was preparing to vote as of press time. GOP leaders were confident they had the support for passage.

If passed, the bill would next need to be reconciled with a House-passed version, a process that leaders hope to complete as early as next week.

Corker, who is retiring at the end of his term, said he would vote no after he was unable to persuade colleagues to install a mechanism to claw back some tax breaks in the future if they worsened the deficit.

"I am disappointed," Corker said. "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."

As recently as Friday morning, passage was uncertain after a tumultuous week that exposed deep fissures among Republicans. Complicating matters for Corker and others was a congressional report released Thursday that refuted GOP assumptions that tax cuts would generate enough economic growth to cover their costs.

A planned procedural vote was abruptly canceled Friday morning as Senate Majority Leader Mitch McConnell huddled with Republicans to address their concerns.

Republicans could lose only two votes from their 52-seat Senate majority to pass the bill, amid Democratic opposition, giving almost every GOP senator an opening to push for a deal.

Sen. Susan Collins, R-Maine, who at times negotiated directly with Trump, secured changes to tilt benefits back toward middle-income households, particularly the reinstatement of a deduction for property taxes _ important to states with high-cost real estate. That deduction had been eliminated as part of a broader repeal of state and local tax deductions for individuals in the original Senate plan.

The property tax deduction will be capped at $10,000, as proposed in the House bill, making reconciliation between the chambers potentially easier, especially because the provision was important to House Republicans from New York, California and other high-tax states.

"You'll see more middle-class relief from that," said Sen. Rob Portman, R-Ohio, who helped broker the deal with Collins.

Collins said she also won assurances from GOP leaders that they would help pass bipartisan bills designed to stabilize Obamacare markets and assist low-income consumers, and protect the Medicare program from possible budget cuts that might arise from the tax plan.

The final Senate bill also includes a repeal of the Affordable Care Act requirement that Americans have health insurance.

The Congressional Budget Office estimated that ending the Obamacare mandate that Americans have insurance would result in higher premiums and leave an additional 13 million Americans without coverage.

In another last-minute change, Republicans dropped plans to repeal the so-called alternative minimum tax for individuals, which would help raise hundreds of billions of dollar to pay retaining the property tax deduction and tax cuts elsewhere.

Eliminating the AMT had been a key component of the GOP's framework, agreed to by congressional Republican leaders and the White House, part of their goal to simplify the tax code. Now Republicans will have to merge the Senate approach with the House bill, which proposed killing the AMT, reducing federal revenue by nearly $700 billion over a decade.

As the debate dragged on Friday, behind the scenes other senators were negotiating agreements, and one by one announced their support.

Another key GOP holdout, Sen. Jeff Flake, R-Ariz., agreed to support the plan after winning a commitment from the White House and GOP leadership that there would be a forthcoming immigration deal to allow young immigrants, known as Dreamers, to permanently remain in the U.S. without threat of deportation if Trump ends the so-called DACA program as planned next year.

Flake spoke personally to Vice President Mike Pence on Friday morning to ensure a seat at the table for an immigration deal.

Sen. Ron Johnson, R-Wis., who had been working to secure bigger tax breaks for businesses and wealthy professionals that organize as pass-through entities, said he received assurances from leaders that some of what he wanted would be included in the final bill.

One change Johnson secured would increase a proposed 17.4 percent deduction of income for those entities to 23 percent, which will be paid for with an increase in the repatriation tax rate for foreign earnings from the original 10 percent to 14 percent, also putting the Senate bill in line with the House version.

It is likely that the Senate and House versions will be swiftly reconciled in a conference committee, though it is also possible that the House may opt to simply approve what the Senate passes.

Unlike the collapse of GOP efforts to repeal Obamacare, Republicans in Congress appear determined to stick together and not let their differences interfere with their goal of passing tax cuts by year-end.

Republicans are hungry for a legislative accomplishment with control of Congress and the White House, especially before they face 2018 midterm voters and deep-pocketed donors, who have grown impatient with other stumbles, particularly on health care.

Groups backed by the wealthy Koch brothers, in particular, have been a constant presence at the Capitol, pushing the tax bill forward.

The rushed process, conducted largely behind closed doors, drew criticism from Democrats and others for foregoing the usual hearings and debate expected for such a major legislative undertaking.

"This is not the way to do business in the U.S. Senate," said Sen. Jeff Merkley, D-Ore., during the floor debate. "This is the way to do business in the swamp."

Overall, the House and Senate bills would be the most massive rewrite of the tax code in a generation, centered on the reduction of the 35 percent corporate rate to 20 percent, its lowest level since the Great Depression.

The bills lower individual rates — the Senate drops the top 39.6 percent rate to 38.5 percent, the House lowers it to 35 percent, other differences that will need to be resolved.

But both bills also do away with many popular deductions used by Americans to reduce their tax bills, including the personal exemption.

Instead, the bills offer an enhanced standard deduction, at $24,000 for couples, and a more generous $2,000 child tax credit in the Senate version.

While taxpayers across income levels are expected to see cuts on average at first, the benefits are uneven and some households, nearly 1 in 10, would see a tax hike, according to the Tax Policy Center.

Nonpartisan analyses show tax benefits flow mainly to the wealthy with reductions of $34,000 a year for the top 1 percent while lower-income households see $50 tax breaks.

And while the corporate cuts are permanent, the individual rates — under the Senate version — expire in 2025, meaning most middle-income taxpayers would face tax increases in eight years.