Three doctors confirmed that Spanish prisoner Gonzalo Montoya Jimenez was dead. His relatives were informed and came to say a final goodbye in the autopsy room.
But before they arrived, Jimenez started snoring.
Spanish authorities have launched an investigation into the 50-year-old convict's apparent resurrection just a few hours after his death certificate was signed on Saturday (6 January).
Spanish media report that guards found Jimenez unresponsive in his cell during a morning roll call in the maximum security wing of the Austurias prison in north-west Spain.
Two doctors arrived at the scene and could not find any sign of life so declared him dead and ordered the body to be removed to a morgue.
Funeral staff transported Jimenez's body to the Legal Medicine Institute of La Corredoria and laid him out on an autopsy table in a body bag. A third doctor confirmed the death.
The "deceased" man's family were told the news and made their way to the morgue to pay their last respects.
Pathologists were about to get to work on his corpse when they were interrupted by snoring sounds from inside the body bag.
Stunned medics rushed Jimenez to hospital where he is reported to be making a full recovery under the supervision of the Civil Guard.
The authorities and Jiminez's family are trying to get to the bottom of what happened.
Sources close to the investigation have told local newspapers that the current hypothesis is that Jimenez was in a cataleptic state.
Catalepsy is a nervous condition characterised by extreme rigidity in the body, unresponsiveness to external stimuli and very slow breathing.
His family are greatly relieved they have not lost their loved one but also furious at the misinformation which sent them into a panic. They are considering legal action, according to reports.