MADRID, Nov 25 (Reuters) - Power firm Endesa said on Thursday it would spend 31 billion euros ($35 billion) in Spain and Portugal by 2030, most of it on grids and green power, as part of an international push by its parent Enel to shift away from fossil fuels.

Europe's largest utility, Italy's Enel has pledged to invest 70 billion euros to almost triple the renewable energy generation capacity it directly owns to 129 gigawatts (GW) by 2030, one of the biggest green budgets among European utilities which are under pressure to combat global warming.

Its Iberian unit aims to boost its renewable energy capacity to about 24 GW in 2030 from 7.8 GW in 2020. This will take up 40% of the long-term investment target, and another 40% will go to strengthening power grids to help them cope with the more intermittent nature of renewable power.

In the short term, Endesa pledged to spend 7.5 billion euros in 2022-2024, less than the 7.9 billion euros it earmarked for the 2021-2023 period, although the target to 2030 has risen by nearly a quarter.

This shorter-term budget does not include projects linked to the European Union's 750 billion euro fund to support the bloc's recovery from the COVID-19 economic slump.

Endesa Chief Executive Jose Bogas said the firm had presented plans for projects worth 23 billion euros that he believed would be eligible for EU funds but was waiting for the Spanish government to establish a mechanism to distribute them.

Endesa said it expected earnings before interest, tax, depreciation and amortisation (EBITDA) to be broadly in line with last year at 4 billion euros and rise to 4.7 billion euros in 2024.

Shares rose more than 3% in early trade and stayed among leaders on Madrid's bourse later in the morning.

Enel's plan to abandon gas by 2040 will require Endesa to stop selling the fuel to its nearly 1.7 million gas clients by then. Endesa also currently operates around 3.8 GW of combined-cycle gas plants between Spain and Portugal.

($1 = 0.8916 euros) (Reporting by Isla Binnie; Editing by Elaine Hardcastle and Edmund Blair)