The fighting took place near the Afghan border in North Waziristan, where militants continue to remain active despite an year-old military operation in the region.
"19 terrorists were killed including 5 of their commanders in an intense exchange of fire with security forces last night in uncleared pocket" of North Waziristan, said military spokesman Major General Asim Saleem Bajwa.
When the militants were cornered and chased by security forces, one of them exploded his suicide jacket, killing seven soldiers, Bajwa said in a statement.
Shawal became a militant stronghold when terrorists took refuge in inaccessible areas of the region, after last year's massive military operation against them in North Waziristan.
Also Read
The military in June last year launched the ground-and-air blitz against militant groups in the tribal area, forcing millions to leave their homes and settle in other areas.
Efforts are underway to clear the last of the strongholds of the rebels, who have killed more than 55,000 people in over a decade of insurgency in Pakistan.