The raid was carried out in Sherotkai area of Lower Dir district in Khyber Pakhtunkhwa province, one of the four administrative provinces of Pakistan.
Army said the militants wearing suicide vests opened fire at the army personnel resulting in a shootout.
Four army men, including Major Ali Salman, were killed in the intelligence-based operation, it said.
One militant was killed while the other blew himself up, Army said, adding that a suspected militant was also arrested in the operation.
Lower Dir is adjacent to Swat where army had to wage a war against militant in 2009 to clean it.