Barcelona city council fined three banks a total of €1.26 million for keeping four apartments in their possession empty for more than two years.
The council issued an unpredecented levy of €315,000 for each of the vacant flats.
Barcelona is trying to ease its existing housing shortage which has been exacerbated by owners choosing more prosperous holiday lets to long-term ones.
The three banks had been given smaller fines a year ago, but failed to correct the situation.
Spain’s two biggest banks, Santander and BBCA, each received one fine while “bad bank” Sareb was given two. Sareb was created in 2013 to take over billions of euros in toxic assets and loans inherited from banks which had been bailed out.
Barcelona Mayor Ada Colau tweeted on Monday night that “having empty flats will turn out to be bad business for banks and large property owners”.
She added: "We want to send a clear message to landlords that BCN stands up to speculation."
The law allowing the council to act against banks with empty homes was approved by the city’s previous administration in 2014, but has been applied only since Colau became mayor in 2015.
Barcelona council believes the number of homes standing empty may be as high as 80,000. Colau has indicated that the right to housing is one of her mayoral priorities and has vowed to build 8,000 new social housing flats.
Many people across the nation during the long years of Great Recession austerity were evicted by their mortgage lenders when unemployment left them unable to meet rising mortgage payments.