Buenos Aires Stock Exchange
The Merval index grew 4.3 percent on Tuesday. Buenos Aires Stock Exchange

The recent pre-agreement between the Spanish oil company Repsol and Argentina's newly state-owned YPF is looking like good news for everyone involved: Repsol SA (MCE:REP) might get $5 billion in compensation, and Argentina might not be facing a lawsuit anymore. Meanwhile, YPF (BVMF:YPFL3) is enjoying a spurt of popularity on the Buenos Aires Stock Exchange.

The Merval benchmark stock index rose 4.3 percent on Tuesday, following the announcement of the pre-agreement, reaching a record 5,769.16 units. YPF shares, which jumped 14.9 percent, had a big part in the overall boost.

Edenor (NYSE:EDN), Argentina’s largest distributor of electricity, also benefited from the market surge. It saw its shares go up 14.7 percent, thanks in part to speculation on energy prices rising.

Should the agreement with Repsol be approved, the Spanish company would receive its compensation in Argentinian bonds, most of them in U.S. dollars. In return, Repsol would drop all legal action against Argentina for expropriating its stake in YPF in 2012. Repsol’s board will review the proposal and make a final decision on Wednesday.

The agreement would top a busy year for YPF, in which it faced the fury of the former owner of 51 percent of its shares, but also attracted interest from many international oil companies. Both U.S. oil giant Chevron (NYSE:CVX) and France's Total (EPA:FP) have signed deals with YPF to exploit the Vaca Muerta site, which is supposed to be big enough to produce 600 million barrels a day.

YPF has also been in talks with Apache Corp. (NYSE:APA) about a possible sale of its assets in Argentina, Reuters reported. The U.S. oil and gas company has stakes in about 25 fields in several provinces in the country, which represent around 6 percent of the company’s production and 3 percent of its reserves. Apache is selling assets to recover from struggles with production.