Despite some diplomatic rough spots and little sign of progress on most of the major issues, American officials who accompanied President Carter on a two-day visit to Mexico have returned to Washington expressing satisfaction with the results.

"We got just what we wanted," one of them said on the return flight from Mexico City Friday afternoon.

What the United States got from the 48-hour visit was an agreement to begin direct government negotiations that could lead to the purchase of Mexican natural gas.

But the president and his aides also got a series of pointed reminders that Mexico, with its newly discovered oil and natural gas riches is determined to end what it considers history of domination and exploitation by its neighbor to the north.

That was the central theme of the Carter visit, which was devoid of any demonstrations of popular warmth for the visiting American president and some blunt public remarks to Carter by Mexican President Jose Lopez Portillo.

Lopez Portillo's toast at a luncheon Wednesday, at which he chided the United States for treating Mexico with "disdain and fear," seemed so unusually harsh for a diplomatic occasion that it caused at least one American official to wonder out loud how someone like Lyndon Johnson would have responded to it.

U.S. officials were concerned enough about the image of Carter being publicly lectured by the president of Mexico that they went to Mexican officials seeking corective action. The result was the soothing words Lopez Portillo offered at a news conference shortly after the U.S. party had left Mexico City Friday.

From the beginning, the president's journey was a troubled one. American officials had set low expectations for its results, correctly predicting that the major issues between the two countries were far too complex and difficult for there to be "any break-throughs" in Mexico City.

Carter's problems were compounded by events elsewhere in the world. On the morning he left Washington, the U.S. embassy in Tehran was overrun by a mob and news reports carried word of the killing in Kabul of the U.S. ambassador to Afghanistan.

These developments, coupled with the chilly reception the president received when he arrived, clearly did not enhance Carter's image as a strong leader.

The agreement to begin negotiations over a possible natural gas sale allowed the U.S. party to leave Mexico with one concrete result and was the principal American objective for the trip. But those negotiations are only a first step in what is bound to be an increasingly complex relationship as the vast oil reserves of southern Mexico grow in importance to an energy-dependent United States.

Energy resources are Mexico's trump card in its dealings with the U.S., contributing to the assertive attitude that the president encountered in Mexico City. To the Mexicans, oil is a lever to be used to win other concessions from the United States on such questions as immigration policy and trade.

The two presidents discussed those questions at length during their two days of talks, but with no apparent movement on either side.

However, U.S. officials said they were encouraged by a joint communique issued at the end of the talks. Lopez Portillo acknowledged that the presence of thousands of illegal aliens from Mexico inside the U.S. is a concern of both countries and not strictly an "American problem," the view that Mexican governments traditionally have taken of the issue.

By the end of the Carter visit, it was clear that steps to resolve these and other issues will have to wait for another day, perhaps beginning with Lopez Portillo's scheduled visit to the United States next summer. The net result of two days of talks was agreement to talk some more and to acknowledge, as the president did in his mild responses to Lopez Portillo's public remarks, Mexico's determination to achieve a more equal relationship with the United States.

"I believe that we have made statements and posed questions in such a manner as to feel satisfied," Lopez Portillo said near the end of the talks. "We have simply proposed those matters. We have simply brought them We have not opened up the road to their solution. But this does point a finger in the right direction."