President-elect Reagan and Mexican President Jose Lopez Portillo met today on a bridge over the Rio Grande in a ceremony both leaders intended to symbolize better U.S.-Mexican relations in the future.

Their public meeting was as staged as the showdown in a western movie, with each approaching the middle of the bridge from his own side of the border.

Instead of a shoot-out, Reagan and Lopez Portillo shook hands as they met, surrounded by aides and Secret Service agents while a grandstand packed by more than 300 reporters and photographers looked on.

Although Reagan and Lopez Portillo disagree sharply in their attitudes toward the crisis in the Central American nations of El Salvador and Nicaragua and there are bilaterial problems causing strains in the U.S.-Mexican relationship, today's meeting was designed to emphasize the positive.

Richard V. Allen, Reagan's choice as White House national security adviser, told reporters that El Salvador was not mentioned and the two leaders discussed the agenda for future meetings between them rather than talk in detail about specific issues today.

Reagan aides said the president-elect's first foreign trip since his election victory was an effort to underline the importance the Reagan administration will give to relations with Mexico.

It was the second time since his election that Reagan broke with his announced policy of not meeting with foreign leaders before his inauguration. He had met earlier with West German Chancellor Helmut Schmidt.

For Lopez Portillo, the meeting was an opportunity to try to fix bilateral relations in a more positive mood after a series of problems he has had with President Carter and his administration.

A joint press statement prepared before the meeting said, "The conversations were held in an atmosphere of friendship and mutual respect and laid the foundation for a personal relationship between the president of Mexico and the next president of the United States."

The two men spent no time alone.

After their public encounter on the Cordova Bridge, 75 feet above the almost dry river bed of the Rio Grande, they drove in the Mexican president's official bus to the Museum of Art and History for their talks.

There was a slightly awkward moment on the bridge when Lopez Portillo strode purposefully toward Reagan while the American appeared momentarily confused and stood still. As a result, their handshake took place, not at the border line as planned, but about 50 feet on the U.S. side.

Allen told reporters that Lopez Portillo's willingness to cross the border was a demonstration of his cordial feelings toward Reagan. A Mexican president is forbidden to leave his country without specific permission from the legislature.

The bridge sign above their heads as they shook hands said in Spanish, "extreme right lane."

A first meeting lasted 43 minutes and was attended by personal aides and a translator, but aides on both sides said the two leaders did most of the talking.

White House Counselor-designate Edwin Meese III and Allen attended the initial talks along with Reagan. Later, Reagan's choice to be deputy White House chief of staff, Michael Deaver, and U.S. Ambassador to Mexico Julian Nava joined the American side.

Reagan told the Mexican leader that he sometimes has the feeling that "we've done too much talking about each other and not enough to each other," Allen said.

Lopez Portillo agreed and suggested that the two leaders meet again soon at a border city. Aides will work out a meeting, which probably will take place in the first six months of the year, Allen said.

Today's meeting came at a time when Mexico, aided by new wealth from its large oil discoveries, is playing a more active role in regional affairs and demanding to be given more weight in international forums.

Allen said both leaders agreed today that their relationship was off to "a very good start."

Reagan's aides approached the meeting ready to discuss trade and illegal immigration questions while Mexican officials said the problems of Central America should be on the agenda as well as the bilateral dispute over fishing rights.

The two leaders decided to finesse potential problems, however, by staying away from specific issues. Reagan flew to Washington following the meeting.

The only mention of El Salvador today came when reporters asked Reagan what could be done about the killings there. "I think I share the anger and grief all of us share," Reagan replied as he arrived at El Paso Airport from Los Angeles.

"I am not yet president so I feel I have no comment on what course of action to take."

Asked if he would characterize the El Salvador government as right-wing, the president-elect said, "No, this is not a right-wing government. There is a moderate government, a right-wing faction and a left-wing faction. There is a kind of three-way civil war."