* Fenosa sells 5 percent under same terms
* IPIC becomes second largest shareholder after Total
* IPIC asks regulator to waive obligation for full bid
* Santander shares close up 5.06 pct
(updates with IPIC's request for full bid waiver, closing share prices)
By Tracy Rucinski
MADRID, March 31 (Reuters) - Spanish bank Santander (SAN.MC) said on Tuesday it had agreed to sell its 32.5 percent of oil company Cepsa CEP.MC to Abu Dhabi fund IPIC at 33 euros per share or about 2.87 billion euros ($3.80 billion) in a widely expected deal.
The price was below the 45 to 55 euros reportedly negotiated last year when talks between Santander and IPIC over Spain's second-largest oil company failed, but was in line with the bank's announcement last month of talks in a 30 to 35 euro band.
Separately, Spanish power firm Union Fenosa UNF.MC said it sold its 5 percent in Cepsa as part of Santander's agreement with IPIC and under the same terms. Fenosa gave Santander a mandate to bundle its holding with the bank's as both sought to divest non-core assets.
IPIC will become Cepsa's second largest shareholder with approximately 47 percent after France's Total (TOTF.PA) following the deal, which is subject to regulatory approval and financing.
In a late statement, IPIC said it has asked Spain's stock market regulator CNMV to waive any obligation for the Abu Dhabi fund to launch a full bid for Cepsa given that there is another partner with a larger stake in the company.
Cepsa's shares closed up 0.76 percent at 31.74 euros, while Santander rose 5.06 percent to 5.19 euros, compared with a 2.81 percent gain on Spain's Ibex-35 (.IBEX) leading share index.
The final price of the deal will be lower to reflect possible dividend payments from Cepsa, Santander said, while noting that the exclusion of Cepsa from its books will not have any impact on its bottom line.
The bank will not book any capital gains from the deal.
"The holding in Cepsa was the last of a series of industrial stakes Banco Santander has sold in recent years in order to focus exclusively on its core retail and commercial banking activities," Santander's chief executive Alfredo Saenz said in a statement.
Fenosa -- which is currently being taken over by Spanish utility Gas Natural (GAS.MC) -- said it will receive about 529 million euros cash from the sale and an estimated 257 million euros in capital gains.
IPIC is wholly owned by the government of Abu Dhabi and has a mandate to invest in the hydrocarbon sector outside of the Emirate.
Cepsa is a petrochemical and refinery group with a large service station network throughout Spain and Portugal. ($1=.7560 Euro) (Additional reporting by Stanley Carvalho in Abu Dhab; Editing by Jon Loades-Carter and Rupert Winchester)