Students at the campus were told to stay indoors as police swept the area and worked to establish whether the gunman acted alone.
The university said the shooting began at 7.15am [1115 GMT] at West Ambler Johnston, a residence hall that houses 895 people.
The attack continued two hours later at Norris Hall, an engineering building at the opposite side of the university campus.
Wendell Flinchum, Virginia Tech police chief, said one student was killed in a dorm and the others were killed in a classroom.
Police said that over the past two weeks there had been bomb threats on the campus, which is attended by over 25,000 full-time students.
They said they have not established links between the bomb alerts and the shootings.
Students said warnings were not given on campus until an e-mail was sent more than two hours after the first dormitory shooting – the approximate time the gunman attacked those in the engineering classroom.
Steger said authorities mistakenly thought the gunman had fled the campus.
"We had no reason to suspect any other incident was going to occur," he said.
He said the university used e-mail and other electronic means to notify members of the university, but it was difficult to reach everyone arriving on the campus.
It was the second time in less than a year that the Virginia Tech campus has been closed because of a shooting.
In August 2006, 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.
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 Coulmbine 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.
"Today the university was struck with a tragedy that we consider of monumental proportions," Charles Steger, president of Virginia Tech, 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."
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.