Spain’s Banco de Sabadell and TSB have reached agreement on a £1.7billion takeover of the British challenger bank, it was announced today.

The deal will see TSB shareholders receive 340p per share and state-backed Lloyds selling its 50% share, which it was was obliged to sell by the end of this year under European Union state aid rules following its bailout during the financial crisis.

The announcement comes a week after plans by Barcelona-based Sabadell were disclosed, causing a surge in TSB’s share price.

It means that investors who bought the stock at the offer price of 260p when TSB floated nine months ago will receive a 31% premium.

Sabadell said it was attracted by a UK banking market with “a well-defined and stable regulatory framework, consistent profitability and good future growth prospects”.

It said it was picking up a “straight-forward retail and small business bank” with a 6% share of UK branches, which attracted 8.4% of new and switching personal bank accounts in 2014.

The Spanish bank said that, under its ownership, “TSB will be able to further enhance its growth strategy and efficiency, benefiting from Sabadell’s resources, experience in SME lending and experience gained in the Spanish banking market”.

Sabadell said it saw opportunities to continue growth in the current account market, and accelerate growth in lending and expansion in the small business sector.

It said potential savings of £160million a year could be made through a switch over of IT systems from those currently provided by Lloyds to Sabadell’s own platform. Lloyds will provide £450m to support the transition.

The Spanish bank said that under the deal it had “received irrevocable undertakings in respect of or has acquired” 50.01% of TSB’s share capital as of yesterday. TSB’s board is to recommend that shareholders accept the offer.

TSB said it was one of the largest cross-border banking deals since the financial crisis. It will boost Spain’s hold on UK banking after Santander’s acquisition of Abbey, Alliance & Leicester and parts of Bradford & Bingley.

Sabadell chairman Josep Oliu Creus said it could “add more value” to TSB’s aim to bring more competition to the UK banking sector.

He added: “We see the UK as an attractive market with a strong regulatory framework, sound macroeconomic fundamentals and exciting prospects for growth.

“TSB is a well-established brand which shares our culture of focusing on our customers and local communities.”

Sabadell also today announced a 1.6bn euro (£1.2bn) rights issue to shore up its balance sheet after splashing out on the British bank.

Sabadell, founded in 1881, has expanded rapidly, doubling in size in the last five years. It is now Spain’s fifth largest bank and also has a presence in the US.

TSB operates 631 branches and serves 4.5 million customers. It recently reported annual profits of £170m.

TSB chief executive Paul Pester, who will continue in his current role, said: “Today’s offer by Sabadell to acquire TSB is a real vote of confidence in TSB, our 8,700 employees and the straightforward, transparent approach we’re bringing to banking in the UK.”

He said with Sabadell’s “firepower” behind it, TSB could accelerate its impact on the UK banking market.

Chairman Will Samuel said: “The offer from Sabadell represents a significant endorsement of TSB’s progress since its IPO and provides TSB shareholders the opportunity to receive today in cash the value that would otherwise be unlocked over time as TSB executes its strategy.”

Mr Pester said he would “never say never” when asked about the possibility of another suitor stepping in but voiced confidence in the Sabadell offer going through “given the real commitment Sabadell has shown”.

The deal is conditional upon clearance by the Bank of England’s Prudential Regulation Authority (PRA).

Mr Pester said: “We have had very good engagement with regulators. We certainly don’t see any red flags or any issues at this stage.”

He indicated the likelihood was that such a deal might be expected to take “three to four months to progress”.

Lloyds chief executive Antonio Horta-Osorio said: “I am delighted to confirm we have agreed terms for the sale of our remaining stake in TSB to Sabadell.

“This is a significant and positive step for the Group and will enable us to meet our commitments to the European Commission, well ahead of its mandated deadline.”

Last year’s TSB flotation was more than 10 times oversubscribed and raised £455m, resulting in its return to the market for the first time since 1995 when it merged with Lloyds.

At the time of the offer, retail investors were lured with the promise of free additional shares should they hold their stock for 12 months.

Following the Sabadell deal Lloyds now says it will compensate those who would have been entitled to the bonus, with the cash value of the shares they would have received.