The army said the attack took place on Sunday on the suburbs of Srinagar, Kashmir's summer capital.
A spokesman from the Pakistan-based Lashkar-e-Taiba group called up newspaper offices in Srinagar, declaring responsibility for the attack.
The offensive came two days after Manmohan Singh, the prime minister of India, proposed a peace treaty with Pakistan.
The army spokesman said: "There was a heavy exchange of fire".
He said one of the attackers was also killed in the incident which took place near the saffron-growing area of Pampore.
Pakistan has welcomed Singh's offer of a "treaty of peace, security and friendship" to replace decades of hostility between the nuclear rivals.
There has been no response from any of the militant groups fighting Indian rule in disputed Kashmir.
Violence has declined in the Himalayan region since India and Pakistan began a peace process more than two years ago, but gun battles are still frequent.