The Chinese capital won out over rival bids from Paris, Osaka, Istanbul, and Toronto.
Beijing received the winning 56 votes in a second round of secret voting. Toronto garnered 22 votes and Paris came in third with 18.
It is the first time China, the world’s most populous country with 1.3 billion citizens, will host the games.
The announcement, made by IOC president Juan Antonio Samaranch, sparked an official celebration of fireworks and singing by tens of thousands in the Chinese capital.
“Comrades! We express our deep thanks to all our friends around the world and to the IOC for helping to make Beijing successful in its Olympic bid,” Chinese President Jiang Zemin told the crowd.
Human rights groups had challenged China’s bid, saying allowing the country to host the games was rewarding a repressive Communist regime.
Exiled Tibetan spiritual leader the Dalai Lama said China had received “the stamp of international approval” to continue abusing human rights.
Others argue the Olympics could serve as a way to improve the human rights situation and spur social and economic reform in China.
Committee members said China deserves the honor because it has played a meaningful role in the games over the last two decades.