Mexico, which touched off the Latin American debt crisis last August, has been doing so well recently that it did not have to borrow $1.1 billion that bankers had agreed to make available May 31, banking sources said yesterday.

Mexico's situation stands in stark contrast to that of Brazil, which was denied more than $1 billion in loan payments May 31 because it was far out of compliance with economic performance targets it had agreed to meet in return for loans from the International Monetary Fund and its bankers.

Mexico, Brazil and several other Latin American nations have had difficulties repaying hundreds of billions of dollars of foreign debts and have negotiated financial rescue packages with their commercial bank lenders as well as the IMF.

Bankers said that Mexico now has far more cash on hand than either the banks, the IMF or the Mexicans themselves anticipated when the rescue packages were being put together last year and early this year.

"It is a heartening development," according to an official of a major U.S. bank. "But it doesn't mean the Mexican crisis is over. Now they're trying to put off drawing the money as long as possible to impress us." Mexico did borrow the $300 million installment due on its three-year IMF loan last month, sources said.

Bankers said Mexico was able to put off drawing the second portion of a $5 billion commercial bank loan because it ran a surprisingly high $2 billion trade surplus in May. The surplus reflected the severity of the Mexican recession, which has discouraged imports. Bankers said Mexico eventually will borrow that $1.1 billion plus another $2.2 billion it has been promised by year's end. The country already borrowed $1.7 billion from its commercial bankers late last winter.

Mexico had expected to run a 1983 deficit of $2.8 billion with the rest of the world. Now, however, it anticipates a so-called current account surplus of $300 million, banking sources said. Even though the price of oil, its biggest export product, has declined sharply, the Latin nation has slashed its imports and is counting on greatly reduced interest payments on its debts. Rates today are far lower than Mexican officials anticipated six months ago.

Brazil and Mexico are the biggest debtors in the developing world. Both have foreign debts approaching $90 billion, most of it owed to commercial banks in the United States, Europe and Japan. Their inability to pay those debts on time has caused the biggest international financial crisis in decades.

Commercial banks, along with the International Monetary Fund, have devised financial rescue packages not only for Brazil and Mexico but also for other similarly strapped nations, including Argentina (which owes about $40 billion), Chile and Peru. Chile, which--like Brazil--is out of compliance with the IMF terms, has conditional commitments for $1.2 billion of the $1.3 billion it needs from its foreign lenders.

An IMF team has been in Brazil for several weeks to discuss a renegotiation of the Brazilian rescue package. Senior officials of that team flew back to Washington last week for brief consultations and are to return to Brazil this week.

A major sticking point in the negotiations is the complex indexing system that automatically compensates Brazilians for changes in inflation--now running at an annual rate in excess of 100 percent. The IMF would like Brazil to take some steps toward "de-indexing" wages to stop them from rising as fast as prices so that Brazil can reduce public spending and borrowing.

Brazilian officials have resisted de-indexing because it would reduce living standards. With political and popular opposition mounting to the IMF, Brazil's military government might face a public outcry if they tamper with the indexing system, sources said.

International bankers are now laying the groundwork for a new medium-term loan of $1.5 billion or more beyond the $4.4 billion they already have agreed to lend Brazil. Brazil urgently needs more money, but such a new loan likely would depend on agreement with the IMF, sources said.