MADRID (Reuters) - Spain's Repsol has agreed to sell its 20 percent stake in Gas Natural to CVC Capital Partners for 3.82 billion euros(3.38 billion pounds), a move that could allow the oil major to restart investment after years of debt reduction.

Repsol will sell the stake to Rioja Bidco Shareholdings, controlled by private equity firm CVC, for a price equivalent to around 19 euros per share, it said on Thursday. Capital gains from the sale were around 400 million euros, it said.

Repsol did not say what it will use the proceeds from the sale for. Options include further cutting debt or investment in assets like renewables.

Analysts at BBVA said on Thursday the company may be tempted to invest the proceeds in renewable or non-fossil fuel alternatives to tempt investors but warned this could expose the group to regulatory and integration risks.

The oil and gas company had long been rumoured to be considering the sale of the non-strategic asset. The reaction to the sale by shares in both companies was muted.

Gas Natural was trading 0.4 percent higher at 18.35 euros at 0922 GMT, while Repsol was 0.57 percent lower.

Repsol has focused on cost reduction in recent years to improve its balance sheet, resulting in recent credit rating upgrades.

Europe's fifth-largest refiner by market value is on track to cut its debt to below 7 billion euros by the end of 2017, down from 8.1 billion euros at the end of 2016 and around 12 billion euros a year earlier.

Repsol and Criteria Caixa, the holding company that owns Caixabank, agreed a near 4-billion-euro deal to each sell a 10 percent stake in Gas Natural to Global Infrastructure Partners in September 2016.

(Reporting by Sonya Dowsett; Editing by Paul Day and Adrian Croft)

Stocks treated in this article : Gas Natural Fenosa, Repsol YPF, CaixaBank