Six of the attackers also died in the shootout at the sprawling army camp in Uri, near the heavily militarized Line of Control dividing the disputed Himalayan territory between India and Pakistan, an Indian police official told AFP.
The raid, one of the deadliest in years on an Indian Kashir army camp, was one of several attacks in the restive region Friday and came days before the state votes in the third of five phases of state elections.
A separate gunbattle erupted in the residential outskirts of Srinagar, the flashpoint region's main city, ahead of a campaign visit Monday by India's new right-wing Prime Minister Narendra Modi.
Modi is slated to address a campaign rally to be held in the city by his Hindu nationalist Bharatiya Janata Party (BJP), which is making a bold bid for power.
Thousands of extra paramilitary troops have been deployed in Kashmir to protect voters from attacks by militants who have called on residents to boycott the state elections.
By mid-afternoon, shooting had ceased and security forces were defusing unexploded grenades.The strongly fortified army camp, home to several hundred soldiers, lies 100 kilometres northwest of Srinagar.
In the separate violence that broke out near the city, "a police party intercepted two militants near a checkpoint and the militants fired," Kashmir inspector-general of police Abdul Gani Mir told AFP. Both were killed.
And in Tral, south of Srinagar, suspected rebels lobbed a grenade at an election campaign vehicle but missed its target and killed an elderly bystander at a bus-stop, injuring six others, a senior police officer said.
Modi's BJP, promising to step up economic development, is looking to win the elections in Kashmir, a possibility seen as unthinkable until very recently.
About a dozen rebel groups have been fighting Indian forces since 1989 for independence or to merge the territory with Pakistan.
The Hindu nationalist party has traditionally had no base in the Kashmir Valley, where local resentment against Indian rule runs high.
Most separatist leaders were either arrested or confined to their houses after the elections were announced.
The elections, whose results are due December 23, have brought increased violence as suspected militants seek to disrupt the voting.
Earlier this week a big gunbattle caused the deaths of an Indian soldier and six militants, while on Monday suspected rebels shot dead a village leader.
The nuclear-armed neighbours have fought two of their three wars over the scenic region, while years of fighting have left tens of thousands dead, most of them civilians.