Soldiers were on a patrol when they encountered the militants in a village in Sumisip town in Basilan province.
The militants were believed to be members of the Abu Sayyaf militant group, said Lieutenant General Corleto Vinluan Jr, a regional military commander.
Troops recovered the bodies of the slain terrorists after the clash, he added.
The military did not suffer any casualties, Vinluan said.
Abu Sayyaf is the most violent Islamist group in the Philippines and has been blamed for some of the worst terrorist attacks in the country, as well as high-profile kidnappings for ransom.
The militants have abducted dozens of foreigners for ransom since 2000.
The group has allied itself with the Islamic State group, which has claimed responsibility for several bombings in the Philippines.
Meanwhile, the Philippines' Department of Health (DOH) reported on Sunday 5,790 new Covid-19 infections, bringing the total number of confirmed cases in the Southeast Asian country to 1,143,963.
The death toll climbed to 19,191 after 140 more patients died from the viral disease, the DOH said.
The Philippines, which has about 110 million population, has tested over 11.8 million people since the outbreak in January 2020. - dpa