The 48-year-old man had to be rescued from the underground container after he climbed into through the tiny gap to retrieve what he thought was a bag of old clothes.
But he became trapped in the container, which operates using a tilting door mechanism to prevent people from raiding the bins, a practice that has become more widespread during Spain's prolonged economic crisis.
The desperate man, who according to local reports is of Romanian nationality and who survives on the streets and in shelters for the homeless, had mistakenly thought the bin contained old clothes destined for recycling.
Ayer agentes del GESC rescatan a un hombre que quedó atrapado en el interior de un contenedor soterrado en el Bº Vistabella. pic.twitter.com/eXBx3sPpUH— Policía Local Murcia (@MurciaPolicia) October 19, 2016
“We just don't know how he managed to climb in there,” said Jose Elias a sergeant with the Murcia Local Police, which shared the photos on Twitter.
He said police officers at the scene were unable to free the man and had to wait for council workers to come and open the container.
He was finally freed after spending around half an hour trapped in the bin and was said to be unhurt.
Murcia is one of Spain's most poverty stricken regions with 31 percent of the population at risk of poverty, according to the latest data from the National Statistics Agency (INE).
Some councils in Spain have introduced locks on rubbish bins to tackle the problem of bin scavenging.