The deaths came a day after Manmohan Singh, the Indian prime minister, vowed to "neutralise and smash" armed separatist groups and urged Pakistan to crack down on "cross-border terrorism" in his Independence Day address to the nation.
A spokesman for the Indian army in Srinagar said on Wednesday: "By killing the five, we've foiled a major militant infiltration attempt."
At least 44,000 people have died since Muslim separatists launched a revolt against Indian rule in 1989.
Also on Wednesday, Indian soldiers continued to battle fighters in Kashmir's northern Machil sector where fighting started late on Tuesday, the army spokesman said.
India accuses Pakistan of arming separatist fighters and sending them into Indian-administered Kashmir across the Line of Control dividing the disputed Himalayan region.
Pakistan denies the charge, saying it gives only moral support to the insurgency and insisting it is trying to prevent rebels from crossing the line.
A peace process aimed at ending the decades-old hostility between nuclear-armed rivals has stalled amid Indian police speculation that a series of train blasts in Mumbai last month that killed 183 people were the work of "elements" in Pakistan opposed to New Delhi's rule in Kashmir.
On Tuesday, two men were killed by crossfire in a shootout between Indian security forces and Muslim gunmen in southern Anantnag district.
The killings brought locals on to the streets in protest. The police wounded a man and three women in Khandaypora village when they opened fire on the protesters, police said.
Police said they began shooting after the demonstrators tried to break through a security cordon. The army has ordered an investigation.
Also on Tuesday, a Kashmiri man detained for having links to militant groups seized a trooper's gun and an armoured truck, before surrendering five hours later.