The IOC picked China over rival bids from Toronto, Paris, Istanbul and Osaka. The decision by Olympic officials in Moscow set off a huge celebration in Beijing.
The result was announced by IOC president Juan Antonio Samaranch who is standing down after 21 years at the helm of the world's leading sports organization.
Beijing won on the second round of a secret ballot, by receiving 56 votes. It defeated Toronto (22), Paris (18) and Istanbul (nine). Osaka was eliminated in the first round of voting, with six votes. Despite criticism of China's human rights record, Beijing was the front-runner throughout the race. IOC members espoused the view that the Olympics would help open China to the world, improve the human rights situation and speed social and economic reforms.
Earlier Friday, Beijing, Toronto, Paris, Osaka and Istanbul began final presentations to the delegates hours before the vote. Beijing was widely regarded as the odds-on favorite.
Paris promised a telegenic Olympics in the shadow of the Eiffel Tower. Toronto portrayed itself as the athletes' bid, with sporting venues along its waterfront. Osaka, Japan and Istanbul insisted they were still in the running despite doubts expressed by Olympic inspectors.
Russian President Vladimir Putin welcomed members of the IOC to the Kremlin on Thursday, saying that the Olympic ideal of "peaceful, honest competition" must live on.
"In the 20th century, the Olympic movement became a powerful force for uniting the world, for uniting humanity," Putin told IOC President Juan Antonio Samaranch and his fellow committee members.
Beijing's victory came seven years after it lost to Sydney by two votes in the election for the 2000 Olympics. Human rights issues were a factor in that defeat, with memories of the 1989 crackdown on pro-democracy demonstrators in Tiananmen Square still fresh.
The 2008 bid was also targeted by human rights activists, who said giving the games to China would reward a Communist regime that brutally represses its citizens and occupies Tibet.
But many IOC members — as well as some politicians — embraced the position that the Olympics would promote positive change in the country of 1.3 billion people.
IOC officials also said China deserved the games because it is a rising sports power which has been a force in the Olympics since returning to the games in 1984 after a 32-year absence.
Toronto and Paris had cast themselves as risk-free "bids of certainty." Toronto portrayed itself as the best bid for the athletes, while Paris played on its allure as the world's favorite tourist city.
But Toronto was hurt by the controversy surrounding its mayor, Mel Lastman, who remarked recently that he feared attending an Olympic meeting in Africa because "I just see myself in a pot of boling water with all these natives dancing around me."
African IOC members raised the matter during Toronto's presentation to the general assembly Friday. Canadian officials said Lastman had offered his apologies. Lastman was left off Toronto's official team at the ceremony.
Paris, meanwhile, was unable to persuade members to keep the Olympics in Europe for a third straight time after the 2004 Summer Games in Athens and 2006 Winter Games in Turin, Italy.
©MMI, CBS Worldwide Inc. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press and Reuters Limited contributed to this report