In jail near Oviedo in northern Spain, the man, whom Spain’s prison authority refused to identify, was found unconscious around 8am (0700 GMT) on Sunday and three doctors “found he presented no signs of life,” a spokeswoman told AFP.
According to Spanish media, the man is called Gonzalo Montoya, he is 29 and is in prison for stealing scrap metal.
He was taken to Oviedo’s forensic medicine institute and woke up just as doctors were about to perform his autopsy, said his father Jose Carlos Montoya.
“He realised they were taking him out of the cover to put him on the table and do an autopsy,” he told reporters, adding his son had been unconscious after swallowing pills in an attempted suicide.
Montoya said doctors had already put marks on Gonzalo’s body for the autopsy.
Spain’s prison authority and the government of the Asturias region where Oviedo is located have opened a probe into the case.