The sale marks one of the closing chapters of an international wrangle sparked in April 2012 when Argentina's President Cristina Kirchner ordered the nationalization of Repsol's YPF.
Repsol said in a statement Wednesday that it had sold the 11.86 percent stake in YPF for $1.26 billion, equal to $26.91 per share, to Morgan Stanley, generating a pre-tax profit of $622 million.
Following the sale, Repsol was left with less than 0.5 percent of YPF, it said.
Repsol owned 51 percent in YPF before the seizure by Buenos Aires, a move that forced it to make provisions of €1.28 billion in 2013 and sent its profits for that year plunging by 90 percent.
Repsol shareholders agreed in March this year to a deal in which Buenos Aires would pay $5 billion compensation for the financial hit.
On April 24th, the Argentine lower house of parliament approved payment of the settlement in the form of government bonds.
Settlement of the dispute could help YPF to lure investment to the vast Vaca Muerta shale oil and gas field in Argentina, which it discovered in 2010.
The find is estimated to contain the equivalent of 22.8 billion barrels of oil, described by Repsol at the time as the largest discovery in its history.