Unions and protesters have vowed to carry on with strikes and protests against the pension reform
The outcome will be a relief to Macron: a successful no-confidence vote would have sunk his government and killed the legislation, which is set to raise the retirement age by two years to 64.
But the relief could be short-lived.
For one thing, the vote was closer than expected. Some 278 MPs voted in favour of the tripartisan, no-confidence motion, just nine short of the 287 needed for it to succeed.
In addition, unions and protesters have vowed to carry on with strikes and protests against the pension reform.
Observers say Macron's failure to find enough support in parliament to put his pension proposals to a vote has already undermined his reformist agenda and weakened his leadership.
As soon as the narrow failure of the vote was announced, lawmakers from the hard left La France Insoumise (LFI, France Unbowed) shouted "Resign!" at Prime Minister Elisabeth Borne and brandished placards that read: "We'll meet in the streets."
"Nothing is solved, we'll continue to do all we can so this reform is pulled back," LFI parliamentary group chief Mathilde Panot told reporters.
Violent unrest has erupted across the country in recent days and trade unions have promised to intensify their strike action, leaving Macron to face the most dangerous challenge to his authority since the "Yellow Vest" uprising over four years ago.
A ninth nationwide day of strikes and protests is scheduled on Thursday.
"We'll meet again on Thursday," Helene Mayans, of the hard-left CGT union, said at a rally in central Paris. There were boos at the rally after the vote result and chants of "strikes" and "blockade." A Reuters reporter saw police fire tear gas at protesters who sought to march beyond the square where the rally was taking place.
Opposition parties will also challenge the bill in the Constitutional Council, which could decide to strike down some or all of it - if it considers it breaches the constitution.
A second motion of no confidence, tabled by the far-right National Rally (RN), also failed, after it gathered only 94 votes. Other opposition parties said they would not vote for it.
Far-right leader Marine Le Pen said Borne should go. She said Macron should call a referendum on the reform but was unlikely to do so. "He's deaf to what the French people want," she told reporters.