Spain doesn’t quite have a process of “personal bankruptcy”, but a physical person can declare himself insolvente, that is, unable to pay. Mind you: doing that falsely is a crime (as in “dealt with in the criminal courts and may lead to imprisonment”).
Estates are responsible for discharging debts, debts don’t go “poof” when someone dies. Inheritors can renounce the whole inheritance, if the debts are more than they think the other stuff is worth.
One of the changes which happened as part of the mortgage changes linked to the Spanish housing bubble is that, where previously the main difference between a mortgage and a personal loan was that the house itself was the guarantee for the loan, many of the mortgages written during those years did not have such a clause. People who suddenly found themselves unable to pay were handing over the keys, but banks often did not accept a “voluntary handover” (I’m not sure why, in theory that should be less costly than getting the keys through a judge’s order) and they were going after the non-payer’s other goods; the judges were failing in the banks’ favor because the mortgages were written in such a way that the borrower was responsible for full payment no matter what. Then there was a case in Navarre (one of the regions where that kind of mortgage wasn’t legal) where the judge failed in favor of the non-payer, since his mortgage did have that clause (as ordained by regional law) and lawyers in the rest of Spain, apparently failing to understand the whole concept of “Spain doesn’t have a single legal system” went into hysterics…
And the government eventually stepped in and came up with a law saying “if someone hands the keys to the bank holding their mortgage, the bank has to suck it up”. So now you can hand the keys for one mortgaged item over without having to also sell everything else you own: many people have done it for a vacation home they could no longer afford, which means that right now is a superb moment to short-buy one (the concept of “short sale” didn’t exist either, and from what I understand it’s faster with the banks that accept them here than it is in the US).