The early morning incident occurred inside an army camp of the 13th Rashtriya Rifles in Safapora in Kashmir's Ganderbal district, the Press Trust of India news agency reported.
The report quoted an army spokesman as saying the five victims were killed as they slept.
"A soldier of a Rashtriya Rifles unit ran amok in the early hours, killing five soldiers before killing himself," the spokesman said.
The attacker, who had been on sentry duty at the camp, reportedly entered one of the barracks and opened fire.
After the shootings, the soldier returned to his post where he shot himself, The Hindu reported.
The army ordered a court of inquiry into the shootings.
Kashmir is claimed by India and Pakistan, both of which have stationed troops on their sides of the province.