Police shed no light on the motive. The gunman, Adam Lanza, was believed to suffer from a personality disorder and lived with his mother, said a law enforcement official who was briefed on the investigation but was not authorized to discuss it.
Panicked parents looking for their children raced to Sandy Hook Elementary in Newtown, a prosperous New England community of about 27,000 people 60 miles northeast of New York City. Police told youngsters at the kindergarten-through-fourth-grade school to close their eyes as they were led from the building so that they wouldn't see the blood and broken glass.
Schoolchildren - some crying, others looking frightened - were escorted through a parking lot in a line, hands on each other's shoulders.
Law enforcement officials speaking on condition of anonymity said that Lanza killed his mother, Nancy Lanza, then drove to the school in her car with at least three guns, including a high-powered rifle that he apparently left in the back of the vehicle, and shot up two classrooms.
At least one parent said Lanza's mother was a substitute teacher there. But her name did not appear on a staff list. And a law enforcement official said investigators were unable to establish any connection so far between her and the school.
At least three guns were found - a Glock and a Sig Sauer, both pistols, inside the school, and a .223-caliber rifle in the back of a car, authorities said. A law enforcement official speaking on condition of anonymity said some of the guns used in the attack may have belonged to Lanza's mother, who had legally purchased five weapons.
Authorities gave no details on exactly how the attack unfolded. But a custodian ran through the halls, warning of a gunman on the loose, and someone switched on the intercom, alerting people in the building to the attack - and perhaps saving many lives - by letting them hear the hysteria going on in the school office, a teacher said.
Teachers locked their doors and ordered children to huddle in a corner or hide in closets as shots echoed through the building.
State Police Lt. Paul Vance said 28 people in all were killed, including the gunman, and a woman who worked at the school was wounded.
Lanza's older brother, 24-year-old Ryan, of Hoboken, N.J., was being questioned, but a law enforcement official said he was not believed to have had a role in the rampage. Investigators were searching his computers and phone records, but he told law enforcement he had not been in touch with his brother since about 2010.
The officials spoke on the condition of anonymity because they were not authorized to discuss the unfolding investigation.
At one point, a law enforcement official mistakenly identified the gunman as Ryan Lanza. Brett Wilshe, a friend of Ryan Lanza's, said Lanza told him the gunman may have had his identification. Updates posted on Ryan Lanza's Facebook page Friday afternoon read, "It wasn't me" and "I was at work."
Robert Licata said his 6-year-old son was in class when the gunman burst in and shot the teacher. "That's when my son grabbed a bunch of his friends and ran out the door," he said. "He was very brave. He waited for his friends."
Stephen Delgiadice said his 8-year-old daughter heard two big bangs. Teachers told her to get in a corner, he said. "It's alarming, especially in Newtown, Connecticut, which we always thought was the safest place in America," he said. His daughter was uninjured.
Theodore Varga was in a meeting with other fourth-grade teachers when he heard the gunfire. He said someone had turned on the intercom so that "you could hear people in the office. You could hear the hysteria that was going on. I think whoever did that saved a lot of people. Everyone in the school was listening to the terror that was transpiring."
On Friday night, hundreds of people packed a Newtown church and stood outside in a vigil for the victims. People held hands, lit candles, and sang "Silent Night" at St. Rose of Lima Church.
Mergim Bajraliu, 17, said he heard the gunshots echo from his home and ran to check on his 9-year-old sister at the school. He said his sister, who was uninjured, heard a scream over the intercom. He said teachers were shaking and crying as they came out of the building.
"Everyone was just traumatized," he said.
Mary Pendergast said her 9-year-old nephew was in the school but wasn't hurt after his music teacher helped him take cover in a closet.
On Friday afternoon, family members were led away from a firehouse that was being used as a staging area. One man, wearing a T-shirt without a jacket, put his arms around a woman as they walked down the middle of the street, oblivious to everything around them. Another woman with tears rolling down her face walked by, carrying a car seat with a baby inside.
"Evil visited this community today and it's too early to speak of recovery, but each parent, each sibling, each member of the family has to understand that Connecticut - we're all in this together. We'll do whatever we can to overcome this event," Gov. Dannel Malloy said.
Obama's comments on the tragedy amounted to one of the most outwardly emotional moments of his presidency.
"The majority of those who died were children - beautiful little kids between the ages of 5 and 10 years old," Obama said.
He paused for several seconds to keep his composure as he teared up and wiped an eye. Nearby, two aides cried and held hands.
"They had their entire lives ahead of them - birthdays, graduations, wedding, kids of their own," Obama continued about the victims. "Among the fallen were also teachers, men and women who devoted their lives to helping our children."
Trail of School Tragedy
Notable school shootings in recent years:
April 2, 2012: A gunman killed seven people at a California Christian university. Jongjin Kim, the Oikos University dean, said the suspect, One Goh, was angry because administrators refused to grant a full tuition refund after he left the nursing program.
Feb. 27, 2012: Three students were killed and two wounded in a shooting rampage that started in a school cafeteria in Chardon, Ohio, as students waited for buses to other schools. Police have charged T.J. Lane, 17 at the time, as an adult.
Feb. 14, 2008: Former student Steven Kazmierczak, 27, opened fire in a lecture hall at Northern Illinois University in DeKalb, Ill., fatally shooting five students and wounding 18 before killing himself.
April 16, 2007: Seung-Hui Cho, 23, fatally shot 32 people in a dorm and a classroom at Virginia Tech in Blacksburg, then killed himself.
Oct. 2, 2006: Charles Carl Roberts IV, 32, shot to death five girls at West Nickel Mines Amish School in Lancaster County, then killed himself.
March 21, 2005: Jeffrey Weise, 16, shot and killed five schoolmates, a teacher, and an unarmed guard at a high school on the Red Lake Indian Reservation in Minnesota before taking his own life. He had earlier killed his grandfather and his grandfather's companion.
Oct. 28, 2002: Robert Flores Jr., 41, who was flunking out of the University of Arizona nursing school, shot and killed three of his professors before killing himself.
March 5, 2001: Charles "Andy" Williams, 15, killed two fellow students and wounded 13 others at Santana High School in Santee, Calif.
April 20, 1999: Eric Harris, 18, and Dylan Klebold, 17, opened fire at Columbine High School in Littleton, Colo., killing 12 classmates and a teacher and wounding 26 before killing themselves in the school library. - Associated Press