The nurse was beaten by the grief-stricken partner before being handed over to police in the Bolivian capital La Paz.
He was named locally last night as Grover Macuchapi, 27.
He is now facing prosecution on charges of profaning a corpse and obscene acts.
Police chief Douglas Uzquiano said the incident happened around an hour after the patient died at Hospital de Clinicas in La Paz on Monday and was transferred to a hospital morgue.
He said: “Relatives of the dead woman had gone to the hospital to cancel a debt they had for the medical treatment she received.
“The husband went to the morgue and saw a male nurse having sex with his late wife.”
The unnamed husband told a local newspaper: “I saw what he was doing and hit him. He was moving and he had his trousers down.”
The hospital worker blamed his actions on a trance.
He was quoted as saying: “Something happened. It was like a dream. The next thing I remember was feeling a blow from behind when the woman’s husband hit me.”
The unnamed female patient, a 28-year-old, had only died around an hour before she was targeted.
Prosecutors said Macuchapi could not be charged with necrophilia because the offence didn’t exist under Peruvian law.
Last May police in Argentina arrested a man who broke into a hospital morgue to have sex with a dead woman.
The 22-year-old drifter told cops he acted out of an “insatiable desire to have sex in the hospital”.
Staff dialled 999 after seeing the pervert had taken a body out of one of the freezers and was standing over his victim with his pants round his ankles.
He was still acting out his sick fantasy when the police arrived and made no attempt to resist arrest.
The bizarre incident happened at San Vicente de Paul Hospital in Oran, north-west Argentina.
The woman he targeted was a 41-year-old from a village 70 miles away whose sudden death was due to be investigated in an autopsy later that morning.
He slipped into the hospital after getting past a security guard who was answering the call of nature.
Local reports said police found cash in a rucksack he was carrying which patients and their families leave the hospital when they are discharged. PLACE YOUR TEXT ADVERT BELOW:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> How I Made Me =N=2.5 MILLION In 7Days from 2 Common Product I Imported and how you can do the same. Click HERE FOR FREE Details right now