In what may prove one of the final acts in Spain’s banking crisis, Banco Santander SA stepped in to take over Banco Popular Espanol SA before the bank collapsed under a mountain of bad property loans.

Santander will tap shareholders for about $7.9 billion to shore up Popular’s balance sheet after acquiring the bank for $1.13 in a deal brokered by European regulators, according to a filing on Wednesday. The deal imposes losses of about $3.7 billion on Popular stock and bondholders and serves as the first real test of European rules to deal with failing banks.