Prime Minister Menachem Begin's ruling Likud coalition won a decisive parliamentary victory today, enacting a restrictive amendment to the abortion law. Had the government lost, it could have fallen.

The Knesset (parliament), in a brief but tumultuous session, voted 58-to-53 to rescind a clause in the law that permitted the termination of pregnancies for social and economic reasons. It became a test of confidence in Begin's government, which has been beset from both the opposition and from within over such other issues as the settlement policy in the occupied West Bank and Gaza Strip.

The ultra-orthodox Agudat Israel Party, a pivotal faction in the Likud coalition, threatened to quit if the abortion amendment was not passed.

Begin's victory underscored his ability to marshal key votes from diverse political factions and seemed to assure that the beleaguered government would remain in power at least until the 1981 elections, barring another major coalition crisis.

Although several Knesset members of Begin's own rightist Herut Party either abstained or stayed away from today's crucial vote, the 14-member liberal faction swung overwhelmingly to Begin's side.

Had the vote failed and forced Agudat Israel to leave the government, the coalition would have been left with a one-vote majority of 61 votes in the 120-member parliament. However, one coalition member, Yosef Tamir of the Liberal Party, defected earlier in the day to the opposition Shai Party, meaning that if Begin had lost the abortion vote, it would be only a matter of time before his government collapsed and new elections were held.

The abortion amendment will have to undergo another reading and vote in the Knesset, but given today's alignment, the same outcome is assured.

The Knesset chamber was packed in anticipation of today's showdown but the debate was almost anticlimatic, with Health Minister Fliezer Shostak giving a desultory denunciation of abortion as "immoral."

Occasionally there were catcalls from the Knesset floor by opponents of the measure, who charged the government with beging a "hostage" to the minority orthodox party.