Pai punched the two-metre (6.5-foot) crocodile in the eye after it bit him just above his right buttock, and despite being in incredible pain and soaked in blood managed to summon help, reports said Saturday.
The attack happened early Friday, when the 32-year-old decided to take his chances in the river in Sarawak state despite knowing it was infested with crocodiles.
The labourer, an Indonesian who works at a nearby construction site, had just finished relieving himself under a bridge when the animal bit him from behind.
“Fortune favoured me when the crocodile let go after I punched it in the eye,” he was quoted by Malay tabloid Harian Metro as saying.
“After being freed from the jaws of the crocodile, I found extraordinary strength to run and call for help even though my waist was extremely painful.”
Several newspapers ran pictures of Pai, who like many Indonesians goes by one name, lying on his stomach at the Sarawak General Hospital with bandages on his waist and hip area.
According to The Star newspaper, he also suffered puncture wounds on the left side of his ribs.
Crocodile attacks have been a constant problem in Malaysia, with several deaths reported in the past few years.
The Star reported that a 14-year-old boy was still recovering at the same hospital after a crocodile attack on Wednesday.
Two years ago, a Malaysian businessman settled out of court for 43,000 ringgit ($14,000) after he was bitten by a crocodile while playing golf at a resort near the historic port town of Malacca just south of Kuala Lumpur.