CaixaBank will pay a consideration of around £630m (€800m) for the total assets of €22.2bn and liabilities of €20.5bn, as at 30 June 2014, and payable in cash upon completion.
The UK headquartered bank also completed the sale of its UAE retail banking business to Abu Dhabi Islamic Bank for an estimated pre-tax gain of £119m.
The UAE transaction is confined to a portfolio of mortgages, unsecured credit and deposits.
In a statement, Barclays group chief executive Antony Jenkins said the bank remained committed to its retained businesses in these territories and that the sales represented “further progress” with Barclays’ strategic review of non-core assets.
“We remain on track to rebalance Barclays as part of our strategy to deliver sustainable returns for our shareholders”, he said.
Spanish lender CaixaBank said in a statement that the purchase “will consolidate its leadership in Spain, gaining approximately 550,000 new customers, mainly from the retail banking and private and personal banking divisions".