Police said the firing took place when a suspected vehicle was asked to stop in Budgam town.
"On specific input, the joint area domination party of Army & Police tried to stop one suspected vehicle, terrorists fired upon and in retaliation two terrorists were killed," a police statement said.
It added that arms and ammunition were recovered from the area.
The identity and the group affiliation of the slain could not be established immediately.