The killed terrorists were identified as Basit Ahmad Mir, a resident of Indergam Pattan, and Gulzar Ahmad, a resident of Brat Sopore.
Following intelligence inputs about the presence of terrorists, security forces had launched a cordon-and-search operation in the area last night, the official said.
The search operation was halted for the night but the forces maintained the cordon to stop the terrorists from escaping, a police official said.
He said the operation resumed this morning and the gunfight started after the trapped terrorists opened fire on the forces.
Two AK rifles, five AK magazines, 124 AK rounds, a hand grenade and a pouch have been found at the encounter site, the official said.
Around 6 pm, a gunbattle broke out between security forces and terrorists in an area of Pulwama district of south Kashmir, police said.
As the security forces were conducting the searches, they were fired upon by some hiding terrorists, he said.
The security forces retaliated, triggering a gunbattle which was going on till last reports came in, the official said.
The exact number of terrorists holed up was not immediately clear but there were reports of two terrorists being there.
There were no reports of any casualties on either side so far.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.