Spanish bank Banco Popular has been rescued from the brink of collapse by larger rival Santander for one euro.
Buying Banco Popular will cost Santander 7bn euros (£6.1bn) - around 2bn euros more than analysts had expected.
Banco Popular was described by the European Central Bank (ECB) as "failing or likely to fail" due to its dwindling cash reserves.
The bank has struggled after billions in property investments turned sour.
The ECB said: "The significant deterioration of the liquidity situation of the bank in recent days led to a determination that the entity would have, in the near future, been unable to pay its debts or other liabilities as they fell due."
The Single Resolution Board (SRB) - the body set up last year to deal with winding up struggling banks - pushed forward the sale after it was informed of the seriousness of the problem on Tuesday night.
A "good deal"
Banco Popular bosses have spent the last few months attempting to shore up the bank's balance sheet by selling various assets.
A bidding process for Banco Popular ended last month, but started to look shaky as a handful of institutions pulled out.
Santander chairman Ana Botin said it was a good deal for the bank.
"The combination of Santander and Popular strengthens the group's geographical diversification at a time of improving economic conditions in both Spain and Portugal."
However, shareholders appeared to disagree, with shares falling by 3% in early trading.
Aberdeen Asset Management's head of credit research Laurent Frings said: "This isn't a big surprise. The regulator has been looking for a solution to Banco Popular's problems for a while and time has essentially run out.
"But this is a test case for the Single Resolution Board, which was created in response to the euro area crisis to try to make the banking system safer."
He added: "This shouldn't pose any real problems for other banks or the banking system in Spain or Europe.
"It's essentially a case of the regulation doing exactly what it was created for. But it does show that there is real risk in investing in these second tier names in the banking sector."
Banco Popular customers will be unaffected, and the ECB already protects all EU savers with deposits of up to 100,000 euros.
But shareholders and bondholders will lose out as their investments become worthless.
The SRB was set up to deal with any struggling banks after the 2012 eurozone crisis threatened the economies of entire countries.
In Spain, banks had so much risky debt it worried investors buying sovereign wealth bonds, making borrowing by the country more expensive.
Savers are protected
Government ministers were eventually forced to borrow 41bn euros to prop up its lenders and reassure investors.
With the SRB in place, the risk is supposed to be taken off individual countries when a bank is struggling.
The body's creation was also aimed at calming tensions, which led to protests and riots against banks in 2013.
Officials in Frankfurt at the ECB monitor the EU's 125 biggest banks and the SRB steps in when a collapse looks likely.
They can either reorganise the bank's structure, liquidate it or force through a sale - as they did with Banco Popular and Santander.
Banco Popular unveiled a 3.5bn-euro loss last year as bosses continued to struggle to deal with nearly $40bn (£31bn) of toxic property loans.
It launched three rounds of fundraising from investors over the last five years, raising a total of 5.5bn euros.