Gunner Rishi Kumar stopped the advancing terrorists, who had already killed a Captain and two other soldiers, from penetrating deeper into the camp which is located about 100 km from Srinagar.
Rishi Kumar, who was on sentry duty, was hit by a bullet in the head but escaped death because of his protective gear.
Undeterred, the gunner of the Field Artillery Regiment, engaged the terrorists, killing two of them before he was injured by the third one who fled afterwards.
"Gunner Rishi Kumar was on sentry duty when the fire fight (with militants) started. He observed the terrorists approach and waited for them to come within close range," the spokesman said while giving details of the 35-minute encounter this morning.
"He then engaged them and was hit on his head but was saved by bullet proof patka," the spokesman said in Srinagar.
"During the incident, Rishi Kumar has shown the indomitable spirit of Indian soldier," he added.
Interacting with media persons from his hospital bed here, Rishi Kumar said, "When I saw the terrorists approaching me while firing, I took position, fired at them and killed two terrorists."
Rishi Kumar, who hails from Ara in Bihar, has eight years of service in the army.
In the attack, Captain Ayush Yadav and two soldiers were killed while five other soldiers were injured.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.