Relieved Republicans have muscled their healthcare bill through the US House of Representatives, taking their biggest step towards dismantling the Obama healthcare overhaul since Donald Trump took office.
They won passage only after overcoming their own divisions that nearly sank the measure six weeks ago.
Jubilant Republicans, celebrating what they hope will soon be the demise of Obamacare, sang the pop song "Na Na Hey Hey Kiss Him Goodbye" as the end of the voting neared.
The measure skirted through the House by a thin 217-213 vote, as all voting Democrats and a group of mostly moderate Republican holdouts voted no.
Another defeat would have been politically devastating for President Trump and Speaker Paul Ryan.
Passage was a product of heavy lobbying by the White House and Republican leaders, plus late revisions that nailed down the final supporters needed.
The bill now faces an uncertain fate in the Senate, where even Republican politicians say major changes are likely.
"Many of us are here because we pledged to cast this very vote," Mr Ryan said.
He added: "Are we going to keep the promises that we made, or are we going to falter?"
Leaders rallied rank-and-file politicians at a closed-door meeting early today by playing Eye Of The Tiger, the rousing 1980s song from the Rocky III film.
Republicans have promised to erase President Barack Obama's law since its 2010 enactment, but this year - with Mr Trump in the White House and in full control of Congress - is their first real chance to deliver.
But polls have shown a public distaste for the repeal effort and a gain in popularity for Mr Obama's statute, and Democrats - solidly opposing the Bill - said Republicans would pay a price in next year's congressional elections.
"You vote for this Bill, you'll have walked the plank from moderate to radical," said House Minority Leader Nancy Pelosi, warning Republicans that voters would punish them.
"You will glow in the dark on this one."
The bitter healthcare battle dominated the Capitol even as Congress prepared to give final approval to a bipartisan one trillion dollar measure financing federal agencies through until September.
The House passed that legislation yesterday, and certain Senate passage will head off a weekend federal shutdown that both parties preferred to avoid.
Mr Ryan cancelled a March vote on the healthcare bill because disgruntled conservatives said the measure was too meek while Republican moderates said its cuts were too deep.
He abandoned a second attempt for a vote last week. As late as Tuesday, the Associated Press counted 21 Republican opponents - one short of the number that would kill the measure if all Democrats voted no.
Over the past few weeks, the measure was revamped to attract most hard-line conservatives and some Republican centrists.
In a final tweak, leaders added a modest pool of money to help people with pre-existing medical conditions afford coverage, a concern that caused a near-fatal rebellion among Republicans in recent days.
The bill would eliminate tax penalties in Obama's law which has clamped down on people who do not buy coverage and it erases tax increases in the Affordable Care Act on higher-earning people and the health industry.
It cuts the Medicaid programme for low-income people and lets states impose work requirements on Medicaid recipients.
It transforms Mr Obama's subsidies for millions buying insurance - largely based on people's incomes and premium costs - into tax credits that rise with consumers' ages.
It would retain Mr Obama's requirement that family policies cover grown children until age 26.
But states could get federal waivers freeing insurers from other Obama coverage requirements. With waivers, insurers could charge people with pre-existing illnesses far higher rates than healthy customers, boost prices for older consumers to whatever they wish and ignore the mandate that they cover specified services such as pregnancy care.
The bill would block federal payments to Planned Parenthood for a year, considered a triumph by many anti-abortion Republicans.
Republican candidates including Mr Trump have made repealing Mr Obama's statute an epitome of their campaign pledges, claiming it is a failing system that is leaving people with rising healthcare costs and less access to care.
Republicans will "gut Obamacare and rescue the American people", said Representative Doug Collins.
Democrats defended Mr Obama's law, one of his crowning domestic achievements, for expanding coverage to 20 million Americans and forcing insurers to offer more generous benefits.
They said the Republican measure would throw millions off coverage while delivering tax cuts to the wealthy.
"How can you do this to the American people, how can you do this to the people you represent?" asked Representative Jim McGovern.
The non-partisan Congressional Budget Office estimated in March that the Republican bill would end coverage for 24 million people over a decade.
That office also said the bill's subsidies would be less generous for many, especially lower-earning and older people not yet 65 and qualifying for Medicare.
Earlier this week, moderates objected that constituents with pre-existing conditions could effectively be denied coverage by insurers charging them exorbitant premiums.
But Republican leaders seemed to win over a raft of wavering politicians after adding eight billion dollars over five years for state high-risk pools, aimed at helping seriously ill people pay expensive premiums. That was on top of 130 billion dollars already in the Bill for states to help customers, though critics said those amounts were insufficient.
The House overwhelmingly approved a second bill that Republicans wrote to snuff out a glaring political liability.
The measure would delete language in the healthcare measure entitling members of Congress and their staffs to Mr Obama's coverage requirements, even if their home states annul them.