Two unidentified militants were killed in an encounter with security forces in Anantnag district in Jammu and Kashmir on Wednesday, police said.