President Carter, exhausted but oviously elated by the achievement of a major diplomatic breakthrough that could rewrite the history of the Middle East, returned to Washington early today and declared that "the way has been opened to peace" between Israel and Egypt.

Fourteen hours after he announced in Cairo that Egyptian President Anwar Sadat and Israeli Prime Minister Menachem Begin had accepted new compromise American peace proposals, the president stepped off Air Force One to an emotional welcome home from hundreds of people including Vice President Mondale, Cabinet officials, and dozens of members of Congress and White House aides.

"You are looking at a tired but grateful man," Carter told the welcoming delegation, many of whom had come by special buses to Andrews Air Force Base for the occasion.

Although he said there may be "sharp internal debates" in Israel and Egypt before a treaty is finally signed, Carter said his six-day mission to the Middle East had "confirmed all major components of a peace treaty between the largest Arab country, Egypt, and its neighbor and former enemy, Israel."

The treaty that finally emerged from the tortuous peace process, he added, "can be the conerstone of a comprehensive settlement, one that can bless with peace all the peoples who have suffered from the conflicts in the Middle East."

Carter said all that now stands in the way of a peace treaty is acceptance by the Israeli Cabinet and parliament of American proposals on two outstanding issues, reported to involve the exchange of ambassadors between Israel and Egypt and Israeli access to oil in the Sinai region, which would be returned to Egypt under the terms of the peace treaty.

Neither in his prepared homecoming statement nor in Cairo did the president say that peace had been achieved. But if, as expected, the Israeli Cabinet accepts the proposals in a meeting scheduled for today and the Israeli parliament then approves them, the long-awaited treaty will be ready for signing, American officials said.

It thus appeared that final agreement was imminent after an extraordinary personal effort by Carter that several times brought the negotiations back from the brink of failure.

Cairo newspapers reported in their early editions today that the treaty could be signed in Washington next week. In Israel, Begin said that if Israel's parliament approves the new language, "we can sign an agreement within a very short time."

Carter's terse, carefully worded statement in Cairo, which he described as "extremely important," was issued after a 2 1/2-hour meeting with Sadat at the Cairo airport that was a late addition to his schedule.

During the airport meeting, Carter submitted new U.S.-drafted language to Sadat on the remaining issues that he had discussed with Begin over breakfast in Jerusalem. Begin had already agreed to submit them to his Cabinet, according to U.S. officials, and when Sadat accepted them, Carter telephoned Begin from Cairo airport and in Sadat's presence told the Israeli prime minister what he was about to announce.

Sadat looked on somberly and said nothing as Carter spoke to reporters and television cameras at Cairo airport. Carter immediately boarded his plane to return to Washington and Sadat climbed into his helicopter, avoiding the journalists waiting to question him.

There was little display of enthusiasm except from Egyptian Vice President Hosni Mobarak, who embraced U.S. national security adviser Zbigniew Brzezinski and pounded him on the back.

Carter did not say what the remaining issues were or who had yielded on which ones. In a briefing afterward, White House press secretary Jody Powell said it would not be "appropriate" to spell them out.

It was learned from authoritative sources in Cairo, however, that they dealt with the future of the Gaza Strip, Israeli demands for guaranteed access to oil in the Sinai Peninsula, and the nature of diplomatic relations to be established after the treaty is signed.

High-ranking Egyptian officials indicated that one of these issues, oil, had been resolved in favor of the Egyptian view, with Israel getting no advance commitments for continued access to it. The issue of diplomatic relations reportedly was resolved in favor of Israel, with Egypt agreeing to an earlier exchange of ambassadors. The third issue, Gaza, reportedly was resolved by a formula that leaves both sides free to explore it in future negotiations.

In Israel, informed government sources said that the issue of diplomatic relations were tied to Israeli agreement for a precise timetable for a speeded-up withdrawal from the Sinai peninsula.

Conclusion of a treaty would finally crown with success a process that began with Sadat's journey to Jerusalem in November, 1977 -- a process whose heady promise of immediate peace gradually gave way to disillusionment and recrimination as the negotiations sputtered and broke off.

The repeated interventions by Carter kept the process alive. His latest triumph, achleved only after a series of frustrating failures, is likely to shore up his political fortunes at home, as did the Camp David agreements last summer, but even now it is not clear whether the treaty will turn out to be a first step toward a regional peace in the Middle East or the flashpoint for a new conflagration resulting from the opposition of most of the Arab world to what has been done.

Sadat, committed to a peace treaty, has been obliged to stage a steady retreat from his original objective of a regional peace based on unconditional Israeli withdrawal from all the territories occupied in 1967.

Since he signed the Camp David agreements setting up the framework for the treaty negotiations, Sadat has been ostracized and denounced by most of the Arab world for pursuing what the other Arabs see as a separate peace that gets Israel out of Sinai but does not ensure that it will pull out of the West Bank or the Golan Heights, to say nothing of East Jerusalem.

Sadat's confidence that the other Arabs would follow where he led has been shaken, and there appears to be little in the proposed treaty package that would bring them along. New denunciations are already emanating from other Arab capitals, and even Egyptians who favor the treaty question whether the formula for Palestinian autonomy can actually be implemented.

Like Sadat, Carter and Begin have insisted that their objective is a comprehensive regional peace, and they say the treaty is the first part of a framework, not an isolated document.

The agreement Carter announced in Cairo was achieved only after a series of American interventions and commitments that have little to do directly with peace between Egypt and Israel.

Bascially, Sadat appears to have yielded in his position on Palestinian autonomy because Carter pledged that he would personally keep pursuing it until the Camp David formula is implemented. The Israelis appear to have retreated from their demands for an oil guarantee because Carter promised them that the United States would ensure their supplies if necessary.

In addition, well-informed sources confirmed that the Carter administration is planning to ask Congress for substantial amounts of economic and military aid for both Egypt and Israel after the treaty is signed.

The meeting between Carter and Sadat had been anticipated as a brief session in which Carter would tell Sadat that he had failed to close the remaining gaps while in Israel.

But it turned into a long bargaining session between the two men and their top advisers in which Sadat accepted the new formula Carter put to Begin Tuesday morning.

Those formulas, according to Powell, originated in a telephone call from Israeli Foreign Minister Moshe Dayan to Secretary of State Cyrus Vance Monday night, when no compromise on the remaining issues seemed possible. Powell said Vance and Dayan then met, and Tuesday morning, before his breakfast meeting with Begin, Carter heard from Vance what Dayan had said. Then, Powell said, Carter offered new suggestions to Begin, and the gloomy picture was turned around.

"When we make such a suggestion or proposal and one or both sides finds it to be unacceptable, then of course we go back and look for another way to skin the cat. And we try again, and usually again and again and again. Every now and then, it works," Powell said.

Asked "which cat did you skin?" he replied, "Most of the skin has come off the American hide so far."

The final three issues, on which U.S. officials were saying Monday night that no compromise was in sight, were these:

The Gaza Strip: Egypt wanted Israel to agree to move in the Gaza first on negotiations for Palestinian autonomy, rather than simultaneously with the West Bank, where they feared there would be greater difficulty. Israel originally opposed this on the ground that it differed from the Camp David agreements, but is now said to have agreed to consider it. The Israelis reportedly did not yield to Egyptian requests to move Egyptian liaison officers into Gaza during the negotiations.

Sinai oil: Israel wanted guarantees that Egypt would sell it all the oil the Sinai wells could produce. Egypt did not want to make any commitment, other than to say it would treat Israel like any other commercial customer after relations were normalized. The Israelis were concerned about the loss of their supplies from Iran, supplier of 60 percent of Israel's oil, but Egyptian sources say Sadat prevailed on this point after the United States offered to strengthen its own guarantee to Israel.

Exchange of ambassadors: The draft treaty negotiated last year provides that ambassadors are to be exchanged in conjunction with phased Israeli troop withdrawal from the Sinai. Egypt had been saying it wanted diplomatic relations at a lower level until the Palestinian autonomy envisaged at Camp David is established. Powell said there were no changes in the language of the treaty package itself, indicating that diplomatic relations will be established at the ambassadorial level.

No matter how all these points are presented in Egyptian reports to the other Arabs, it will be said correctly, that the treaty package gives Sadat much less in the way of commitments about the future of the Palestinians than he said he would settle for.

The five-year transition period leading to autonomy in the occupied territories does not even begin to run until local elections are held there, and there is apparently no fixed date for those elections.

Jerusalem was not even mentioned, although it remains a major issue.

The problem Egypt has now is how to sell the treaty to the other Arabs and persuade them to drop their rapidly strengthening alliances against it.

The sales pitch begins Wednesday with a trip by Vice President Mobarak to the Sudan, Sadat's most faithful friend in the Arab world.

Sadat is also sending messages to all the other Arab countries except the five hard-line states aligned against him -- Libya, Syria, Algeria, Iraq and South Yemen -- and Kuwait, which has been strongly critical of Sadat' policies.

On his arrival in Washington today, Carter stressed the political risks to him and the dangers to U.S. prestige in his extraordinary exercise and personal shuttle diplomacy.

"We did not go to Egypt and Israel in order to confirm a result guaranteed in advance," he said. "We went there to use our influence and our good offices to help the leaders of two great nations move decisively toward the peace that is so ardently desired by the people they serve. There were risks involved -- political risks to me as president -- and therefore, perhaps, to the prestige of the United States.

"Fortunately, our work has had a happy result," he continued.

Calling on other world leaders to support the Egyptian-Israel agreement, Carter praised Sadat and Begin for "daring to break the pattern of 30 years of bitterness and war" and pledged U.S. support to their effort.

"They are following the advice of the Biblical proverb: 'when a man's ways please the Lord, he maketh even his enemies to be at peace with him,'" the president said.

"In choosing peace, President Sadat and Prime Minister Begin are ventuing into the unknown. They know that these United States will be with them as they begin to make peace a living reality for their people. I am thankful that the friendship between their countries and the United States will now grow even stronger and more meaningful."

Carter's reception at Andrews Air Force Base was far from routine. The buses carrying congressional and adininistration dignitaries, which were hastily arranged during the day by White House and congressional officials, began arriving around midnight.

The Marine Corps Band was also turned out to greet the chief executive. Despite the lateness of the arrival, all three commercial television networks broadcast the ceremony live.

Except for the late hour, which undoubtedly shrunk the television audience, the president could not have wished for a better setting for his return to Washington. The night sky was cloudless and a full moon shone overhead when the presidential jet rolled to a stop in front of a red carpet at the arrival area at 12:30 a.m. today.

The Marine Band marched up beside the aircraft and broke into a rendition of "Hail to the Chief" as Carter and his wife, Rosalynn, emerged from the plane. The president spread his arms in a sign of welcome and waved as he and Mrs. Carter stood momentarily at the top of the aircraft ramp basking in the applause from the primarily Democratic crowd below them.

Along the red carpet, one of the first to greet Carter was House speaker Thomas T. (Tip) O'Neill (D-Mass.), who embraced him in a smothering bear hug. The president worked his way along the red carpet, reaching out to shake hands with the crowd, which included some of the best-known political figures in Washington.

Mondale's welcoming remarks were brief. "Welcome home to a proud and hopeful nation," he said at their conclusion.

The president, who was extremely cautious in his public comments throughout his mission to the Middle East, appeared optimistic that the process begun at the Camp David summit conference last September would at last succeed in achieving a peace treaty. He remarked that he had left orders to awaken him if the Israeli Cabinet decision brings in good news, adding, "I believe that it will."

"I believe that God has answered our prayers," Carter added.

Also contributing to this article was Washington Post staff writer Martin Schram, traveling with Carter .