After years of debate, the House on Thursday voted to repeal key parts of the Affordable Care Act and replace them with new provisions.
But winning approval for the bill could be even more difficult in the Senate than it has been in the House, where Republican leaders struggled for nearly two months to wrangle enough votes in their caucus to secure its passage.
The bill passed by a vote of 217 to 213, which was one more "yes" vote that was needed for passage.
All 193 Democrats voting opposed the bill. They were joined by 20 Republicans voting "no."
"A lot of us have waited seven years to case this vote," House Speaker Paul Ryan, R-Wis., said shortly before the voting began. "Many of us are here because we pledged to cast this vote: to repeal and replace Obamacare."
"This bill delivers the promises we have made to the American people," Ryan said.
House Majority Whip Steve Scalise, R-La., told MSNBC shortly before the vote began, "We were elected to do this."
After the vote, protesters outside the Capitol building yelled, "Shame, shame!" at members of Congress walking down the front steps.
The bill — which would dramatically change the way the federal government funds purchases of individual health plans and Medicaid — is expected to dramatically increase the number of people without health insurance if enacted into law.
Thursday's vote came a week after the bill was amended to include a provision that won support from conservative holdouts. That provision would, under certain conditions, undo Obamacare's ban on letting insurers charge people with pre-existing health conditions more for their insurance plans than healthy people.
Moderate Republicans initially blanched at that provision. But on Wednesday a number of them agreed to support the bill after the addition of another amendment that would increase funding designed to reduce the impact of the higher premiums on people with pre-existing conditions. Analysis questions how far that funding may go to cut costs for those Americans.
The bill, known as the American Health Care Act, would remove the Obamacare rule requiring most Americans to have health coverage of some kind.