After being told of Jackson's death Thursday in Los Angeles, the 1,500 inmates at the Cebu Provincial Detention and Rehabilitation Center hit the exercise yard, practicing for nine hours Friday night - and into the wee hours of Saturday morning - for the show.
They took breaks only to eat or when it rained, said professional choreographer Gwendolyn Lador, hired by the prison to teach the inmates the dance.
"I felt sad because we lost our idol," said inmate Wenjiel Resane, who plays the role of Jackson's girlfriend in the video.
Crisanto Nieri, 38, was feeling a little extra stress. He danced Jackson's part in "Thriller."
"Even as a kid, he was already my idol," said Nieri, who is serving seven years on drug charges. "I am happy that our video became famous, but I feel some pressure to perform well."
A crowd of 700 Cebuanos and foreign tourists watched the performance from a second-floor corridor, swaying to the music and applauding as the inmates, dressed in orange prison T-shirts and sweat pants, stomped and clapped in unison in the hilltop prison, behind thick stone walls topped by electrified razor wire.
Other numbers included "Ben," "I'll Be There" and "We Are the World." The inmates then held up a 5-by-10 foot tarpaulin showing Michael Jackson holding a sword with his name written below it.
Others waved the flags of the Philippines and other nations.
Before the show, the performers dedicated a prayer to Jackson's family.
"I was sad because one of the songs of Michael Jackson, 'Thriller,' made us famous around the world," said Francis Mercader, 36, who has spent a year in detention while on trial for drug charges.
Byron Garcia, the Cebu provincial security consultant who came up with the idea of adding synchronized dancing to poorly attended exercise sessions, said he was surprised by the popularity of the 2007 video - one of more than a dozen inmate dance numbers he has posted on YouTube.
"Thriller" has attracted 24.3 million hits since it was posted two years ago, with nearly a million of them in the 24 hours since news of Jackson's death spread.
The inmates "consider Michael Jackson as a god here," Garcia said. "If not for Michael Jackson, they would not have this international recognition.
"The fame brought them back their self-esteem," he told reporters. "So that's why we have these public performances."
Inmate Alfredo Gaballo, 52, says Jackson "inspired us, so we are all sad about his death."
"The performance today has been amazing," said Karen Benrad, 29, from London. She and about two dozen foreign and local tourists later joined the inmates at the prison quadrangle, dancing to the tune of "Macarena" and "I just can't get enough."
Kim Hua-sung, a 23-year-old South Korean student in Cebu who watched the inmates' performance, said he is also a Jackson fan. "I'm sad that I can't listen to more songs from him."
In Taiwan, two top Michael Jackson impersonators donned fedora hats and sequined outfits Saturday, moonwalking to "Billie Jean" in their own tribute to the pop star.
Thirty-year-old Wang Chih-wei told The Associated Press he secured a photo op with his idol during Jackson's whirlwind tour in 1993 after winning an impersonation contest.
"I didn't know much English so I could only tell him, 'I love you,"' Wang said. "He was very friendly. I melted when he put his hand on my shoulder for the photo."
Watch CBS Videos Online
More Michael Jackson coverage:
Lisa Marie: Jackson Foresaw His End
Jackson Doctor Under Increased Scrutiny
Jackson Family Questions Promoter's Role
Quincy Jones: "I Miss My Little Brother"
Motown's Gordy On Discovering Jackson
Gary, Indiana Mourns Hometown Star
The Man With The Moves
King Of Pop Lived In Luxury, Died In Debt
Coroner: Cause Of Jackson Death Deffered
911 Caller: Jackson "Not Breathing"
KHOU: Texas MD With Jackson Amid Collapse
A Collection Of CBS Videos Of Michael Jackson
The Death Of Michael Jackson: Full Coverage
By Associated Press Writer Teresa Cerojano; AP writer Debby Wu contributed to this report from Taipei, Taiwan