"Their identities and affiliations are being ascertained," said a police spokesman, in a statement.
Giving details, he said the encounter broke out after the security forces launched a cordon and search operation in Sopore following "credible" inputs about the presence of terrorists.
"As the searches were going on, the hiding terrorists fired on the search party. The fire was retaliated leading to an encounter.
In the ensuing encounter, two terrorists were killed and the bodies were retrieved from the site of encounter," he said.
Police has registered a case and initiated investigation in the matter, he said.
"Incriminating materials including arms and ammunition were recovered from the site of encounter.
Citizens are requested not to venture inside the encounter zone since such an area can prove dangerous due to stray explosive materials."