The battle started last Wednesday when militants ambushed and killed two soldiers and a police officer who were patrolling the Gadole forests in the disputed territory.
Over the following days, three more soldiers were found dead after they went missing during the protracted firefight.
The Indian army deployed helicopters and drones and launched bombs into the forests while pursuing the attackers.
Police officer Vijay Kumar said two militants were killed in the battle including Uzair Khan, a local commander of the Pakistan-based militant group Lashkar-e-Taiba.
“We have spotted one more body of a dead militant,” Kumar told reporters, adding that no more gunmen were at large.
Kashmir is divided between India and Pakistan, with both countries claiming it in full and fighting two wars over control of the Himalayan territory.
A violent insurgency beginning in 1989 killed tens of thousands of people including Indian troops, militants and civilians.
New Delhi accuses Islamabad of supporting the rebels, claims Pakistan denies.
Prime Minister Narendra Modi’s government stripped the Indian-administered section of Kashmir of its limited constitutional autonomy in 2019 and imposed direct rule.
Deadly battles between security forces and rebels have been less common in the years since.
Two other gunfights in Kashmir this month claimed the lives of three security forces personnel and five suspected rebels.