A plan to repeal and replace Obamacare that Senate Republicans have been working on for months has failed to get the 60 votes needed for approval.
The vote was 43 in favour and 57 against. Nine Republicans voted against the measure.
The plan would have made deep cuts to Medicaid, the health insurance program for the poor, and reduced Obamacare subsidies to lower-income people to help them defray the cost of health insurance.
It was the first of many expected votes this week on repealing or replacing elements of former president Barack Obama's signature healthcare law.
McCain votes to scrap Obamacare
Senate Republicans narrowly agreed on Tuesday night (local time) to open debate on a bill to end Obamacare.
The Senate deadlocked 50-50 on moving forward with the healthcare debate, forcing Vice President Mike Pence to cast the tie-breaking vote.
Senator John McCain, who was diagnosed this month with brain cancer and has been recovering from surgery at home in Arizona, made a dramatic return to cast a crucial vote in favour of proceeding.
The outcome was a huge relief for President Donald Trump, who had pushed his fellow Republicans hard in recent days to live up to the party's campaign promises to repeal the 2010 Affordable Care Act, commonly known as Obamacare.
Minutes after the vote, Mr Trump called it "a big step".
But the narrow victory on a simple procedural matter raised questions about whether Republicans can muster the votes necessary to pass any of the various approaches to repeal.
Moderates are worried repeal will cost millions of low-income Americans their insurance and conservatives are angry the proposed bills do not go far enough to gut Obamacare, which they consider government overreach.
Earlier Senator McCain, 80, received an ovation from his fellow senators when he entered the chamber to cast a vote to open debate.
After that vote, he decried growing partisanship in the Senate and urged members to learn how "to trust each other again."
Two Republicans opposed the measure to open debate, and with Republicans controlling the Senate by a 52-48 majority, those were the only votes the party leadership could afford to lose.
Democrats were united in opposition to the motion to proceed.
'We have a duty to act'
A loss on the vote to open debate on Tuesday could have been a death blow for Republican efforts to repeal Obamacare and cast doubt on Mr Trump's prospects to achieve any of his other top legislative agenda items, including tax reform.
"We have a duty to act," Senate Majority Leader Mitch McConnell told senators before the vote, reminding Republicans they had promised to repeal Obamacare in four straight elections.
"We can't let this moment slip by."
Republicans have found it difficult to fulfil their campaign promises to repeal Obamacare, which enabled 20 million more Americans to get health insurance.
Polls show Obamacare is now far more popular than the Republican alternatives.
The nonpartisan Congressional Budget Office has estimated the Senate's replacement bill could lead to as many as 22 million fewer Americans being insured.