BUENOS AIRES, Argentina – Argentina is hoping to have an easier time attracting international investors to exploit its oil and gas fields now that lawmakers have agreed to pay $5 billion to the Spanish company Grupo Repsol for its controlling stake in the YPF oil company.

President Cristina Fernandez nationalized the company two years ago without paying anything beforehand to Respsol, which had demanded $10.5 billion in compensation.

The deal was approved early Thursday by a vote of 135-59, with 42 deputies abstaining after a marathon debate in Argentina’s legislature.

Repsol’s board and shareholders already agreed to accept the package of dollar-denominated bonds, accepting less than half what Repsol President Antonio Brufau said the company’s 51 per cent stake was worth.

“We have worked very hard to obtain a just compensation. Our efforts have been rewarded with an agreement that creates value for our shareholders and strengthens the company’s financial position,” Brufau told shareholders in March. A company spokesman said Thursday that there would be no additional comment.

In the deal, Repsol agreed to drop all legal action against YPF as well as its threats to sue potential investors in the Vaca Muerta shale deposits that the company discovered in Argentina’s Patagonia region under Repsol’s leadership.

Fernandez and her economy ministers justified the seizure of the controlling 51 per cent stake in YPF by arguing the Madrid-based Repsol had failed to invest sufficiently in exploration and oil development in Argentina, obligating the government to spend billions of dollars on fuel imports.

Repsol said Fernandez had only herself to blame because price controls, consumer subsidies and ever-changing energy policies made it impossible to count on a return from its investments.

The Vaca Muerta find remains one of the world’s largest potential sources of shale oil and natural gas, and YPF’s executives have been trying to attract deep-pocketed international partners willing to make the long-term investments needed to extract it using hydraulic fracturing technology. The deal could mark a turning point for the Fernandez government, which has been running out of money to keep importing fuel.

Repsol’s indemnity includes a new 10-year bond paying 8.75 per cent interest worth $3.25 billion, another 2017 bond paying 7 per cent interest valued at $500 million, and a third bond, due in 2033 and paying 8.28 per cent interest, valued at $1.25 billion. Argentina also promised Repsol an additional $1 billion in bonds should the package not reach a market value of $4.76 billion, on the condition that Repsol return any net profits exceeding the agreed-upon $5 billion total.