Once bitter rivals, Brazil and Argentina in recent months have been forging an increasingly close cooperative relationship, laying the foundation for what both countries hope could become greater political and economic integration in Latin America generally.

The growing links between South America's two largest powers were highlighted in late February, when Brazil adopted an economic shock plan similar to the price freeze and new currency program instituted by Argentina last year.

The moves were preceded by months of consultations between Brazilian and Argentine economists, who devised a theoretical framework promoting shock therapy as a cure for high inflation. Some of those economists now hold senior policy-making jobs in their respective governments and continue to exchange ideas.

Beyond a convergence of economic programs, the new, closer Brazilian-Argentine relationship touches on military, scientific, nuclear power and foreign policy issues. Brazilian president Jose Sarney and Argentine president Raul Alfonsin talk regularly by phone on a range of matters affecting not only bilateral concerns but the foreign debt, Central America and relations with the United States.

Both leaders are reserved, cautious men who had not met before last year and who have constrasting backgrounds. Alfonsin made his way in politics, while Sarney is a man of letters. But the two have established a large measure of mutual confidence, according to aides.

Both leaders share an abiding interest in securing democracy in their countries, which emerged from military regimes only in the past year or two. Cementing their relationship, the two presidents held official talks last November at the symbolically significant site of a bridge spanning the Iguazu River, which separates the two countries.

Several factors are driving Brazil and Argentina together. One is a common desire to minimize conflicts that in the past caused military buildups. Also important to both is the need to build defenses against destabilizing economic pressures. Argentina looks upon giant, fast-growing Brazil as a lucrative market and potential provider of technology and investment capital, while Brazil sees Argentina as a source of natural gas and oil and some agricultural products.

A long-term aim on both sides is to use their relationship to work toward the elusive dream of Latin American integration.

At his meeting with Sarney, Alfonsin stressed the need to "go beyond exclusively bilateral issues to analyze problems that affect not only our own countries but Latin America as a whole."

Paulo Tarso Flecha de Lima, Brazil's deputy foreign minister, said in an interview in Brasilia: "Our ultimate aim is to increase economic integration in Latin America. The path of Brazil-Argentina relations sets the rhythm for cooperation among all Latin American countries. If Argentina and Brazil are really able to proceed successfully, they will provide a good example to other Latin American countries."

But despite recent demonstrations of political amity, Brazil and Argentina are still far from enjoying an easy friendship. Their national attitudes and levels of development differ sharply. Argentina is an aging society of 30 million people whose industrial growth peaked decades ago. Brazil, with a population four times as great, is a booming frontier country.

In Argentina, the dominant mood is one of nostalgia and melancholy. In Brazil, few look back.

Officials in each country acknowledge the need to put their own heavily indebted, inflation-prone economies in order before extensive cross-border integration can be realized. Argentine industrialists, suffering an inferiority complex in the face of Brazil's astounding 8 percent growth rate last year and $13 billion trade surplus, are especially hesitant about cutting deals from a position of weakness with their neighbor.

"As long as the Argentines feel inferior, it will be difficult for them to accept full industrial integration with Brazil," said a Brazilian official knowledgeable about the relationship. "This is the real stumbling block."

"The main financial and trade channels of each country still go to the United States, Europe and the Soviet Union," said Oscar Camilion, a former Argentine foreign minister. "For the first time, though, you do have people looking at the possibility of forging something more bold and imaginative."

Perhaps the most sensitive and disquieting issue dividing Brazil and Argentina is nuclear power. It is one of the few areas in which Argentina still holds an edge, and each country continues to suspect the other of secretly working to build a bomb.

They signed a nuclear cooperation agreement in 1980. But despite subsequent exchanges of information, Brazilian officials were shocked by Argentina's disclosure in 1983 that it had developed the potential for nuclear enrichment, a key step in the production of nuclear weapons and a stage that few countries in the world have reached.

"The people here hadn't expected such a development and felt the Argentines hadn't been quite candid," said a well-placed Brazilian official, who asked not to be named. "I believe this has created some uneasiness."

Last November, the two countries signed a pact committing them to the peaceful use of nuclear energy and establishing a joint committee composed of foreign ministry and atomic energy experts. The group is to meet regularly in hopes of working out a safeguard system, possibly involving bilateral verification procedures.

Brazilian and Argentine soldiers have clashed only once -- in 1926 -- in a dispute over Spanish and Portuguese claims to the territory today occupied by Uruguay, a country created in 1830 as a buffer between its two large neighbors.

But for most of the past two centuries, Brazil and Argentina each have viewed the other suspiciously as vying for hegemony on the continent. Tensions eased briefly in the late 1950s and early 1960s, the last period until 1985 that both countries enjoyed democratic governments at the same time.

A turning point came again in 1979 with the resolution of a dispute over dam-building rights on the Parana River. The settlement opened the way for a flow of agreements affecting commerce, culture and nuclear energy. When Argentina went to war against Britain in 1982 over the Falkland Islands, Brazil lent coastal radar planes to Argentina and supported Buenos Aires in the United Nations. Nevertheless, at the same time, Brazil let British C130 transport planes land on its territory for refueling.

At the Brazilian-Argentine summit last November a joint economic commission and an agreement to cooperate in biotechnology research for pharmaceuticals was reached. A few weeks later, an aeronautical agreement was reached between Embraer, Brazil's aircraft manufacturer, and FMA, Argentina's military aircraft producer, to cooperate in the production of parts for civilian and military planes.

To help ease Argentine concerns about an industrial imbalance, Brazil agreed to erase its 1985 trade surplus with Argentina of $350 million by buying Argentine wheat and oil products.

For all the mutual good will being shown at government levels, much of the new sense of Brazilian-Argentine brotherhood has yet to filter down to grassroots levels, where views tend to be pretty much what they've always been.

"Argentines still think of Brazil largely in terms of tourism and soccer," said Marcelo Cavarozzi, a prominent Argentine political scientist. "There is still a limited conception here in business, labor, academia and the military of the importance of Brazil to Argentina."

The rest of Latin America, occupied by smaller states that have for years deftly sought to play off the Brazilian-Argentine rivalry, extracting concessions from both countries, eyes recent developments with a mix of relief, disappointment and wariness.

"The other South American states really aren't eager to see Argentina and Brazil draw too near," said Camilion, who was Argentina's ambassador to Brazil in the late 1970s. "But actually, no one is very afraid, because no one would bet a fortune on this process lasting."