The university said that the shooting began at 7.15am (11:15 GMT) at West Ambler Johnston, a residence hall that houses 895 people, where two people were killed.
The killing continued two hours later at Norris hall, an engineering building at the opposite side of the campus, where the attacker shot dead 30 people before killing himself.
Police said they were still investigating the shooting at the dormitory when they got word of gunfire at the classroom building.
They arrived to find the doors to the building chained shut from the inside. They forced their way in and followed the sound of gunshots to the second floor where they found that the attacker had killed himself.
Wendell Flinchum, the Virginia Tech police chief, said the scene at Norris hall was "one of worst things I've seen in my life".
Witnesses reported seeing students jump out classroom windows to escape the gunfire and students and staff carried out some of the wounded themselves.
Students said there had been no public-address announcements or other warnings on campus after the first attack until an email more than two hours after the first shooting - about the time the gunman struck again.
|Students were not warned after the first |
shooting except for an email [GALLO/GETTY]
Andrew Capers Thompson, a 22-year-old graduate student, said: "We were kept in the dark a lot about exactly what was going on."
Charles Steger, Virginia Tech's president, said the authorities believed that the first shooting at the dormitory was a domestic dispute and mistakenly thought the attacker had fled the campus.
"We had no reason to suspect any other incident was going to occur," he said.
He defended the university's handling of the incident, saying: "We can only make decisions based on the information you had on the time. You don't have hours to reflect on it."
He said the university used email and telephone as well as sent people to knock on doors to spread the word, but it was difficult to reach everyone arriving on the campus.
Police said that over the past two weeks there had been bomb threats on the campus, which is attended by more than 25,000 full-time students, but had not established links between the bomb alerts and the shootings.
Investigators offered no motive for the attack and the gunman's name was not immediately released, nor was it revealed if he had been a student.
Shocked and horrified
It is the second time in less than a year that the Virginia Tech campus has been closed because of a shooting.
In August last year, opening day classes were cancelled and the campus closed when an escaped prisoner allegedly killed a hospital guard off campus and fled to the Tech area.
December 1989 - Marc Lepine shot dead 14 women in Montreal's Ecole Polytechnique.
August 1966 - Charles Whitman climbed to the 28th-floor observation deck of a clock tower and opened fire at the University of Texas, killing 16 people before police killed him.
March 1996 - Thomas Hamilton killed 16 children and their teacher at a school in Dunblane in Scotland.
March 1997 - Mohammad Ahman al-Naziri killed six children and two staff during attacks on two schools in Sanaa, Yemen.
April 1999 - Two students killed 12 students and a teacher at Columbine High School in the United States.
February 2002 - A former student thrown out of trade school shot dead three people in Freising, Germany
April 2002 - Eighteen people died when a former student opened fire at a high school in Erfurt, Germany after being expelled.
October 2006 - A man killed five girls and wounded seven before killing himself in an Amish school in Pennsylvania, US.
Steger said "the university is shocked and indeed horrified".
George Bush, the US president, said his administration would do its utmost to assist the university's community.
"Schools should be places of safety, sanctuary and learning ... When that sanctuary is violated, the impact is felt in every American classroom, in every American community," he said.
The shooting is the worst at a university campus in the US since Charles Whitman killed 15 people at the University of Texas site in Austin in 1966.
The worst school massacre in US history occurred in 1927 when Andrew Kehoe detonated explosives at a school in Bath, Michigan, killing 45 people and injuring 61.