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.
"He immediately recovered and fired back to kill the two terrorists. Running out of ammunition, he moved out of his bunker and tried to pick the weapon of the slain terrorists to engage the third, who fired and injured him, thus managing to escape," the spokesman said.
"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.