Spanish oil major Repsol signed a definitive settlement agreement Thursday with Argentine President Cristina Fernandez's administration, which transferred more than $5 billion in bonds as compensation for the 2012 expropriation of Repsol's controlling stake in energy firm YPF.

Combined with Repsol's move this week to sell most of its remaining interest in YPF to Morgan Stanley, the settlement brings an end to Repsol's 15-year presence in Argentina.

Economy Minister Axel Kicillof signed the deal with a group of representatives from Repsol, which as part of the settlement agreed to drop all legal action against Argentina.

The agreement was signed just hours after the Argentine government formally issued the expropriation-related bonds.

In accordance with the terms of the deal, Argentina delivered to Repsol a portfolio of sovereign bonds maturing between 2017 and 2033. The bonds, whose interest rates range from 7 percent to 8.75 percent, have a total nominal value of $5.3 billion.

On Wednesday, Repsol announced that it sold an 11.8 percent stake in YPF to Morgan Stanley for $1.26 billion, a transaction that yielded a capital gain of $620 million and left it with a roughly 0.5 percent interest in the Argentine company.

After a two-year dispute that caused Spanish-Argentine bilateral relations to sour, the two sides said there were no winners or losers in the settlement.

Repsol is expected to use the proceeds from the compensation deal to make acquisitions and continue growing as a company, while the settlement opens the door for Argentina to attract foreign investment and resolve a serious energy crisis.

YPF plays a major role throughout Argentina's oil and gas supply chain and is of strategic importance to Fernandez, whose term as president expires in 2015.

Founded in 1922 as a state-owned enterprise, YPF was privatized during the 1989-1999 administration of Carlos Menem.

In January 1999, Repsol bought a 14.9 percent stake in YPF for around $2 billion and in April of that year launched a $13.4 billion tender offer for the rest of the company's share capital.

Argentine group Petersen - owned by the Eskenazi family, which had close ties to then-President Nestor Kirchner, Fernandez's late husband - acquired 14.9 percent of YPF from Repsol in 2007 and in May of 2011 purchased an additional 10 percent.

In May 2012, Argentina's Congress backed Fernandez's move to nationalize YPF by seizing a 51 percent stake in the company from Repsol.

In carrying out the expropriation, her government alleged underinvestment in the South American country's hydrocarbons sector, although Repsol vehemently denied the accusation. EFE