There were unconfirmed reports that four militants were killed in the ensuing gunfight.
A senior Army officer said that heavily-armed militants in police uniform stormed the 166 artillery unit, opening indiscriminate fire.
An army officer and two other personnel were killed while several others were injured in the attack, the senior officer said.
A fierce gunbattle is underway at the site, a senior police officer said.
Nagrota is the headquarters of the Army's 16 corps.
In view of the attack, the Jammu-Srinagar National Highway has been closed for traffic in the area.The district administration has closed all schools in Nagorta tehsil as a precautionary measure.
"We have ordered closure of all schools and education institutions in Nagrota tehsil in view of the terror attack", Deputy Commissioner, Jammu, Simrandeep Singh said.
An alert has been sounded in Jammu city.