WASHINGTON — The massive Republican tax legislation stood at just one House vote away Wednesday from being enacted by Congress as the first major tax-code overhaul in three decades, following Senate approval of a revised version early Wednesday.

Senate Republicans passed the amended tax legislation by a party-line vote of 51-48 shortly before 1 a.m. Wednesday. Several hours earlier on Tuesday afternoon, the House approved the reconciled version of the House and Senate bills 227-203 — with all Democrats and a dozen Republicans, including both Long Island GOP congressmen, voting no.

Before the tax legislation can go to the president’s desk for his signature, however, the House must vote again on the Senate’s revised version, which was created to comply with the Senate parliamentarian’s ruling that three provisions in the House-passed bill must be removed under the rules. Senate Republicans failed to overturn that ruling by falling short of the 60 votes needed.

Earlier Tuesday, congressman voiced confidence in the bill’s passage.

“I think we’re going to move forward again on a very tight timetable,” said Rep. Kevin Brady (R-Texas), chairman of the tax-writing House Ways and Means Committee, predicting success on Tuesday night.

Sens. Bernie Sanders (I-Vt.) and Ron Wyden (D-Ore.), members on tax-writing committees, said the required revote showed that the bill might include other errors “in the mad dash to provide tax breaks for their billionaire campaign contributors.”

Get the Breaking News newsletter! Get the latest breaking news as it happens. By clicking Sign up, you agree to our privacy policy.

The barred measures included the use of 529 college savings accounts for home schooling; an exemption from a college endowment excise tax for universities with fewer than 500 tuition-paying students; and the barred use of any short title, in this case, the much-repeated Republican talking point, “The Tax Cuts and Jobs Act.”

Until that procedural speed bump, the Republican-controlled Congress had been racing ahead on its fast track begun just a few months ago to pass its 500-page tax bill — and to hand President Donald Trump his first major legislative achievement.

“This really is a generational defining moment. This is our chance. This is our moment,” said House Speaker Paul Ryan (R-Wis.), who was interrupted by shouts of protesters in the visitors’ gallery opposed to the tax bill — a sporadic protest that continued through the voting.

House Minority Leader Nancy Pelosi (D-Calif.) said before the vote: “The GOP tax scam is simply theft — monumental, brazen theft from the American middle class and from every person that aspires to reach it.”

The bill deeply cuts corporate rates to 21 percent from 35 percent, lowers the rates on small businesses and pass-through entities, and sets a lower rate to lure businesses to repatriate profits held overseas.

The bill preserves seven brackets for individual taxpayers, but lowers all the rates — including lowering the top to 37 percent from 39.6 percent — while doubling the standard deduction and retaining deductibility of charitable contributions, medical expenses and student loan interest. But it also eliminates the personal exemptions and most other deductions.

Democrats charged the bill will benefit Trump, his family and his businesses — including hundreds of limited liability companies, or LLCs, that get a tax break — despite his claim that he will hit hard by its provisions.

“In some ways — particularly on the personal side — the president will likely take a big hit,” White House press secretary Sarah Huckabee Sanders said. “But on the business side, he could benefit.”

The bill also ends the Affordable Care Act requirement to buy health insurance and allows drilling in Alaska’s Arctic National Wildlife Refuge.

A Monmouth University poll released Monday found 47 percent disapprove and 26 percent approve of the tax bills passed in the House and Senate. A CNN poll on Tuesday said 55 percent oppose and 33 percent approve the final bill.

The legislation also ends the full deductibility of state and local taxes, offering instead a $10,000 cap for deducting property, sales and state income taxes.

With that change, Long Island and New York, as well as other high-tax states, are girding for a potential bump in taxes for some residents and, according to the Long Island Board of Realtors, a 10 percent or more decline in real estate values.