He managed to clamber up onto La Model prison roof on Tuesday morning and when he was cornered up there by a team of officers from the Mossos d'Esquadra, he threatened to throw himself off the roof, forcing them to back down.
For hours the inmate, whose name is Roberto, sat, stood and paced along the rooftops while other inmates shouted their support from inside.
He claimed that he had been wrongly imprisoned and was not guilty of the crime of aggravated burglary for which he is serving a 20-year-sentence.
As morning turned into afternoon and then into evening and the stand-off continued, his relatives were called in to talk sense to him and eventually after ten hours he was persuaded down from the roof.
The protest was reportedly sparked after the prisoner learnt that he was to be transferred to a prison in Lleida, a move that upset him because it would make it hard for his wife, who is expecting their baby, to make regular visits.
Prison authorities confirmed that the inmate would face disciplinary action for his protest and would be stripped of prisoner rights for a short period.
It was the second incident at the prison within a week. Last Friday two inmates were caught staging an audacious escape attempt.
Prison guards were alerted when their tools hit a metal sheet as the pair attempted to tunnel out of their cell. They had several sheets knotted together to use to escape over the perimeter wall.