After five months of zigzagging through repeated crises, the Egyptian-Israeli peace talks wound up being saved by the negotiations' coming full circle.

The result, according to the sources familiar with the last-minute compromises, now seems certain to be a peace treaty that, with only one major exception, is based on proposals that were agreed upon tentatively and then rejected by one side or the other shortly after the bargaining began in Washington last October.

Both Egypt and Israel then adopted tough positions that led, through weeks of negotiating deadlock, to President Carter's Middle East mediating trip in a last-ditch effort to pull the talks back from the brink of collapse.

That he succeeded wasy due, in the end, to the willingness of the two sides to abandon the more adamant demands they had insisted upon during December and January and to take up anew the impasse-breaking solutions proposed earlier.

As a result, except for a few minor word changes and explanatory notes, the emerging treaty is known to conform very closely to the proposed treaty package that had been put on the bargaining table by U.S. mediators in November.

For example, one of the hitches worked out by Carter during the final hours of his trip covers the question of when the two countries will exchange ambassadors to cap their opening of diplomatic relations. The solution accepted uses exactly the same formula proposed here in late October and then cast aside in a dispute between Egyptian President Anwar Sadat and Israeli Prime Minister Menachem Begin.

That formula calls for Israeli forces occupying the Sinai Peninsula to be pulled back in specified phases of two or three months' duration until, at the end of nine months, they have been withdrawn to a line extending from Al Arish to Ras Muhammed. If that withdrawal is accomplished on schedule the exchange of ambassadors will take place one month later.

Similarly, another last-minute compromise involved Sadat's dropping of a demand that Egyptian liaison officers be stationed in the Israeli-occupied Gaza Strip during negotiations on autonomy for the area's Palestinian inhabitants. Egypt had put forward that demand in late November and had stuck to it tenaciously in subsequent negotiations.

Instead, the final agreement will follow earlier proposals, which made no provision for putting Egyptian liaison teams in Gaza. The agreement does provide for further discussions on this question.

The third of the compromises negotiated by Carter at the tail end of his trip did cover a subject left unresolved in the early negotiations here -- Israel's access to oil pumped from Sinai fields after the peninsula is returned to Egyptian control.

In the Washington talks, there had been no agreement about whether Israel should get preferential treatment in terms of supply and price for the Sinai oil. At that time last fall, that was regarded as a secondary question that could be dealt with later.

However, the situation was changed by the upheavals in Iran and the refusal of the new government in that country, previously Israel's largest energy supplier, to sell more oil to the Israelis. As a result, the Begin government early this year hardened its demands for preferential treatment on Sinai oil.

That issue is to be resolved in an annex of the treaty specifying that Israel has a right to buy Sinai oil -- although on the same terms as Egypt's other potential customers. As a compensatory reassurance to Israel, the United States has agreed to extend from five to 15 years an existing commitment to help Israel find alternate energy sources if its imports fall short of its needs.

The successful compromise of these three issues cleared the last stumbling blocks in the path of the treaty to be signed after expected approval of its provisions by the Israeli parliament. Although no plans for a signing have been announced, reliable sources said last night that Sadat tentatively is planning to come to Washington next Thursday for the ceremony.

Earlier, Carter had succeeded in breaking the long impasse over what had been the two toughest problems in the peace negotiations -- its linkage to separate negotiations on Palestian autonomy in Gaza and the Israeli-occupied West Bank and the question of whether the treaty takes precedence over other pacts of the two nations.

In accordance with Egyptian demands and earlier U.S. suggestions, the treaty will be accompanied by a one-year target timetable for limited Palestinian self-government elections in these areas. But the timetable is much less specific than Egypt had wanted.

The United States has agreed to participate directly in the Palestinian negotiations, and Egyptian acting Foreign Minister Boutros Ghali said yesterday in Cairo that Egypt regards this as a U.S. effort to carry out Carter's pledge to help the Palestinians achieve autonomy.

On the question of the treaty's primacy, Sadat previously had balked at Israeli insistence on a clause giving the peace accord priority over Egypt's mutual defense pacts with other Arab states.

Under Carter's mediation, Sadat and Begin agreed to accept wording in that clause stating that other treaty obligations of the two nations "should not contravene" the peace agreement.

In addition to the actual provisions of the treaty, the United States has also made certain pledges of military and financial assistance to both countries. All details of these commitments are not known, but it was revealed last night that military representatives of both nations are expected here Saturday to begin exploratory talks on increased arms aid.