The israeli parliament returned Prime Minister Menachem Begin's Likud coalition to power tonight by a three-vote margin.

The 61-to-58 vote came shortly before midnight, following a marathon 14-hour debate punctuated by acerbic attacks on Begin's performance in four years in office and charges that he "sold" the government to the small religious parties that are pivotal in the new coalition.

For Begin, 67, the vote represented a dramatic comeback from virtual political ruin six months ago, when Begin's Cabinet was crumbling in bitter divisivenes, and public opinions polls predicted an overwhelming victory for the opposition Labor Party. Begin's Likud block defeated Labor 48 seats to 47 in the June 30 national election, but one successful independent candidate later joined the Labor Alignment, bringing the two parties even.

With the 13 seats controlled by the three religious parties, Begin mustered enough support to present his coalition to the 120-member Knesset for a vote of confidence. One Labor member was absent.

Housing Minister David Levy, who had refused to join the government because a Ministry of Immigrant Absorption was split away from his portfolio, came back in at the last moment, when Begin gave him additional posts of deputy prime minister and chairman of a ministerial committee on social welfare.

In a 45-minute opening speech to the 10th Knesset, Begin appeared to savor his come-from-behind victory, often glancing at the Labor Alignment benches as he read out the June 30 election results.

His speech was interrupted frequently by heckling from opposition members, but Begin displayed the kind of aplomb and mild sarcasm that has characterized his Knesset performances whenever he has been inspired by the scent of a political battle.

When badgered by Citizens Rights Movement leader Shulamit Aloni, who earlier had been quoted as saying she planned to go "underground" because of the new government, Begin looked up in mock astonishment and said, "Are you still here? I thought you were underground. If you go underground, please come back and tell me what it is like."

Begin, as leader of the prestatehood Irgun guerrilla movement, was forced into hiding in the 1940s, when British authorities in Palestine put a price on his head.

In a suprise, Begin said he favors a normalization of relations between Israel and the Soviet Union, which severed diplomatic ties after the 1967 war. He said, however, that the Soviets would have to take the initiative in such a renewal.

"Our regimes are different. Let each go his own way. However, normal relations are possible even between countries which maintain regimes that are fundamentally different. Who knows this better than the Soviet Union?" Begin remarked. He added that renewal of ties would be conditioned on the Freedom of Soviet Jews to emigrate to Israel.

Begin also said he hopes to improve relations with France and that he regards President Francois Mitterrand as a "friend of Israel." He reiterated his view that if the United States offered a formal defense treaty, he would accept it.

For his part, opposition leader Shimon Peres, criticizing Begin's concessions to the 13 elected members of the religious parties in order to form a coalition, said, "Israel faces issues of great moment, but none of these were discussed in the negotiations for a coalition. These talks have only been about payoffs for the religous parties and ministries for the power hungry."

In an effort to hold together his shaky coalition, Begin has been talking about appointing an unprecedented 12 deputy ministers, compared to only one in the previous government. Together with the 18 ministers, the new government could account for a fourth of the Knesset's 120 members.