His nation's economy suddenly in a tailspin, Mexican President Jose Lopez Portillo is hard put these days to play the influential hemisphere role he has carved out for his government.
But as the Mexican peso was devalued last week by some 30 percent, amid declining earnings for Mexican oil, Mr. Lopez Portillo went off to Nicaragua this past weekend to firm up Mexico's ties with its leftist Central American neighbor.
The visit was more than symbolic. Ever since the mid-1970s, Mexico has stood behind Nicaragua's Sandinista leadership -- not only during the Sandinistas' long struggle against the Somoza dictatorship, but also in the difficult task of governing the battered nation. Mexican support has ranged from providing Nicaragua with inexpensive oil to backing Nicaragua in hemisphere and international councils.
This has frequently pitted Mexico against United States policy on Nicaragua. The US accuses the Sandinistas of imposing a Cuba-style, Marxist dictatorship on the Nicaraguan people. The Reagan administration sees Nicaragua as a threat to US interests in the Caribbean and Central America.
Mexico, however, argues -- as President Lopez Portillo did recently -- that the Sandinistas are nationalists ''deserving the support of both Mexico and the United States.''
He took this tack again over the weekend, calling on the US to work for improved relations with Nicaragua. During a rally in his honor in Managua, the Nicaraguan capital, he applauded Sandinista leader Daniel Ortega Saavedra's call for friendly ties with the US.
But at the same rally, Ortega took a swipe at the US, showing how far relations between the countries have deteriorated. He linked the US with a bomb blast that killed four porters at Managua's airport 24 hours earlier. Ortega, who is emerging as the top political official in the government, claimed the blast was tied to US plans to destabilize the Sandinista government.
The Lopez Portillo visit sought to firm up Mexican-Nicaraguan relations at a time when many Mexicans -- in government, business, and the military -- are increasingly wary of Nicaraguan links with Cuba and its support of leftist Salvadoran guerrillas.
Indeed, some Mexican officials close to Mr. Lopez Portillo are skeptical of Mexico's support of the Sandinistas in Nicaragua and the leftist guerrillas in El Salvador. Even Lopez Portillo's handpicked successor, Miguel de la Madrid Hurtado, who is assured election next July in Mexico's dominant one-party democracy, is thought to be skittish about the Mexican links to more radical leftists in Central America.
Yet Mr. Lopez Portillo persists in pushing the line. He argues that the Central American leftists are campaigning for economic and social reforms just as Mexican revolutionaries did in the early part of this century.
Although the Nicaragua trip had been planned for weeks, it could not have come at a more fortuitous moment for President Lopez Portillo. He is happy for anything that diverts public attention from increasingly unpleasant economic problems, including sagging oil revenues, whopping federal deficits, soaring inflation, and other oil-spawned distortions.
No sooner had his government whacked the peso's value by 30 percent Feb. 18 than Lopez Portillo went off on his Nicaraguan goodwill visit. Mexican newspapers and television were full of comment on the trip and pictures of the President giving ''abrazos'' (embraces) to Nicaraguan leaders. It was good publicity for the President and tended to obscure the peso devaluation for many Mexicans.
The peso devaluation was not unexpected, although its timing was a surprise. Bankers and economists have been complaining for months that the peso was overvalued in relation to the dollar. Capital flight was becoming a major problem. Imports were increasingly costly. And tourism was down.
There had been some expectation that devaluation would await Mr. de la Madrid's election - and that Mr. Lopez Portillo would devalue the peso in the interim between the election and inauguration. That was what Mr. Lopez Portillo's predecessor, Luis Echeverria Alvarez, did before Lopez Portillo's inauguration. But the economic consequences of the overvalued peso apparently tipped Mr. Lopez Portillo's hand.
The immediate effect of devaluation will be an increase in Mexico's 1982 inflation rate to at least 40 percent from last year's 30 percent, a decrease in interest rates, and perhaps some political tension as well. But the devaluation takes a long step toward straightening out an economic problem.