* Revalues YPF stake at $5 billion
* New valuation reflects imminent settlement with Argentina
* To take 1.28 billion euro writedown in 2013 results
By Tracy Rucinski and Andrés González
MADRID, Feb 21 (Reuters) - Spanish oil major Repsol will take a 1.3 billion euro ($1.8 billion) hit on its stake in energy firm YPF that was seized by Argentina, as a two-year battle for compensation draws to a close.
Repsol has revalued its majority stake in Argentina's largest energy company at $5 billion, to reflect the size of an imminent financial settlement that will end one of the rockiest chapters in the oil major's history.
The compensation package revealed by Reuters on Thursday is expected to be signed before a Repsol board meeting next Tuesday.
Ending the dispute over YPF, which Argentina nationalised in 2012, will allow Repsol to focus on expanding its international exploration and production operations to better compete with larger European rivals such as Eni and Total without a legal battle hanging over its head.
Repsol had been carrying the value of YPF on its books at 5.4 billion euros. It will make a 1.28 billion euro writedown in its 2013 results, it said in a regulatory filing on Friday, to reflect the difference between the book value and the size of the compensation.
It was not clear whether Repsol would use some $2.9 billion of capital gains from the sale of gas assets to Shell to offset the impact of the YPF loss on 2013 results, due to be published next Wednesday, because part of the Shell deal was closed this year.
Repsol has left the door open to paying part of the compensation to shareholders in the form of a special dividend, but prefer to keep cash for potential acquisitions, analysts said. The company has said it is eyeing opportunities in North America.
Shares in Repsol, which have lost 3 percent so far this year, were up 0.19 percent at 18.20 euros at 1300 GMT compared with a slight decline in Spain's blue-chip index.
Repsol will receive already issued Argentine U.S. dollar-denominated bonds and a new ad-hoc 10-year bond, under the terms of the package.
Argentina will issue a $5.5 billion nominal bond as part of the settlement.
Repsol's board is likely to approve the settlement on Tuesday following a long push by leading shareholders Caixa and Mexico's Pemex to end the two-year conflict with Argentina.
Banking powerhouse Caixa has interests in both Argentina and Mexico through a complex web of cross shareholdings. The bank wrote down the value of its 12 percent stake in Repsol in January in anticipation of a compensation deal.
Pemex - with nearly 9.4 percent of Repsol - has close ties to the Argentine government which had struggled to capture foreign investment to develop its vast Vaca Muerta shale field due to threats of lawsuits from Repsol.
While minority shareholders have been more skeptical about a $5 billion settlement, half of Repsol's initial demands for $10.5 billion, analysts said the deal will easily pass at a meeting in the spring given the backing from major shareholders.
"The fact that Argentina is finally recognising $5 billion of debt to Repsol is a major feat. This deal is going through," said Intermoney analyst Alvaro Navarro.