The first blast occurred inside the Catholic church on war-torn Jolo on Sunday morning as mass was being celebrated and was followed by a second explosion outside as troops responded, the regional military spokesman said.
Most victims were churchgoers along with soldiers. The door, pews and glass windows of Mount Carmel Cathedral were blown apart, with bodies strewn across the ground, according to an AFP photographer on the scene.
President Rodrigo Duterte's spokesman condemned the incident as an "act of terrorism and murder".
"We will pursue to the ends of the earth the ruthless perpetrators behind this dastardly crime until every killer is brought to justice and put behind bars. The law will give them no mercy," Salvador Panelo said in a statement.
Five soldiers, a member of the coast guard and 12 civilians were killed while 83 others were wounded, according to regional military spokesman Lieutenant Colonel Gerry Besana.
However the regional police chief Graciano Mijares put the death toll at 27, with 77 people wounded.
The second bomb was left in the utility box of a motorcycle in the parking area outside the church, a military report said.
The army said it airlifted some of the wounded to the nearby city of Zamboanga for medical treatment.
Authorities said the notorious Abu Sayyaf kidnap-for-ransom group could be behind the blasts.
"When you talk about terrorism in Sulu, the primary suspect is always the (Abu Sayyaf) but we are not discounting the possibility that there are other perpetrators," Besana told AFP.