The gunman, identified as Ryan Lanza, was also believed to have died at the school, Sandy Hook Elementary.
Shooting at Newtown primary school in US kills 27 people
NEW YORK // At least 27 people including 18 children have been killed in one of the worst school shootings in US history.
The young victims were all between the ages of 5 and 10.
The gunman, identified by US media as 20-year-old Adam Lanza, is also believed to have died at the scene, in the suburban town of Newtown, Connecticut.
Earlier reports named the shooter as Ryan Lanza, Adam's older brother.
Shortly after 9.30am, police reported that a shooter was in the Sandy Hook Elementary School's main office. Witnesses said the principal and a colleague were killed and that the vice principal was wounded after the gunman opened fire with at least two guns.
"I was in the gym and I heard like seven loud booms and the gym teachers told us to go in the corner and we huddled," A student told NBC. "We all heard these booming noises and we started crying. The gym teachers told us to go into the office where no one could find us. Then a police officer told us to run outside."
Connecticut State Police said one of the guns used in the attack was a .223-calibre rifle.
A location in New Jersey was being searched in connection with the shootings.
Much of the attack was in one kindergarten classroom and an entire class of students was unaccounted for, sources told the Hartford Courant newspaper.
Newtown is an affluent town about 65 miles north-east of New York City. Residents told WNYC radio they could not believe that something like this could happen in such a close-knit community.
The father of a second-grade student told the newspaper that his son's teacher went to check after gunshots rang out in the hall and that the teacher came back and told the class to stand in one corner.
The parent, Richard Wilford, told the paper: "What does a parent think about coming to a school where there's a shooting? It's the most terrifying moment of a parent's life … you have no idea."
On April 20, 1999, at Columbine High School in Colorado, two students shot and killed 12 other students and one teacher, then committed suicide.
In 2007, a student shot and killed 32 and wounded 17 more at Virginia Tech, the deadliest shooting spree at an American school. The shooter also committed suicide.
* With reporting by Associated Press, Reuters and Agence France-Presse
* This article was updated on Dec 15 to name the alleged shooter as Adam Lanza. Earlier reports had incorrectly identified Adam's older brother, Ryan.