WASHINGTON — The Senate voted narrowly on Tuesday to begin debate on a bill to repeal major provisions of the Affordable Care Act, but hours later, Republican leaders suffered a setback when their most comprehensive plan to replace President Barack Obama’s health law fell far short of the votes it needed.

The Tuesday night tally needed to reach 60 votes to overcome a parliamentary objection. Instead, it fell 43-57. The fact that the comprehensive replacement plan came up well short of even 50 votes was an ominous sign for Republican leaders still seeking a formula to pass final health care legislation this week.

For Republicans, the failure ended the day on a sour note, hours after a more triumphant scene on the Senate floor. Lawmakers from both parties had risen to their feet in the afternoon and applauded when Senator John McCain, Republican of Arizona, showed up in the chamber despite his diagnosis of brain cancer. He cast a crucial vote in favor of opening what promises to be a freewheeling, hard-fought debate over the future of the Affordable Care Act.