The soldiers responded to the attack, triggering a gunbattle that lasted for at least three hours, Singh said.
A reinforcement of soldiers and counterinsurgency police encircled the camp as the fighting raged inside, officials said.
In addition to the five deaths, two soldiers were injured in the fighting, Singh said.
There was no independent confirmation of the incident.
On Wednesday, police said government forces killed three rebels in Budgam district during a counterinsurgency operation.
India and Pakistan claim the divided territory of Kashmir in its entirety.
Rebels in the Indian-controlled portion of Kashmir have been fighting New Delhi’s rule since 1989. Most Muslim Kashmiris support the rebel goal of uniting the territory, either under Pakistani rule or as an independent country.
India insists the Kashmir militancy is Pakistan-sponsored terrorism. Pakistan denies the charge, and most Kashmiris consider it a legitimate freedom struggle. Tens of thousands of civilians, rebels and government forces have been killed in the conflict.