The provincial government in a statement said the militants were killed late on Monday night in Ghani Khel district after being ambushed by the National Directorate of Security operatives.
The statement further added that the Taliban commander killed during the operation has been identified as Aimal.
The militants were looking to carry out attacks on the district administrative compound of Ghani Khel and security outposts on the highway, the statement added.
According to the provincial government, the militants were attempting to flee the area when spotted by the security forces.
The other militants killed during the operation have been identified as Almas Afridi, Edris Afridi, Hamza Afridi, Abdullah, and Tufan, the provincial government said.
The statement also added that a hatchback vehicle and some weapons and munitions were also destroyed during the operation.
The weapons and munitions destroyed during the operation included a PKM machine gun, two rocket launchers and four Ak-47 assault rifles.