The Chinese capital beat Almaty in Kazakhstan by just 44 votes to 40, with one abstention, to become the first city to be awarded both the summer and winter Games.
Beijing held the summer Olympics in 2008 in what was then seen as China sealing its place as an emerging superpower.
This time it had presented itself as a safe pair of hands against the former Kazakh capital, which ate into China's support on the International Olympic Committee with an impressive late campaign that played on China's reliance on artificial snow and the vast distances between its venues.
But China's basketball legend Yao Ming and Sports Minister Liu Peng still leaped to their feet in joy when IOC president Thomas Bach announced the result in Kuala Lumpur on Friday (local time).
The 2022 Games will be held in March during the Lunar New Year and with many outdoor events held against a backdrop of the Great Wall of China.
Asia will also host the 2018 Winter Olympics in Pyeongchang, South Korea.
Meanwhile, performers were instructed to break into choreographed celebrations at a number of locations around China after the announcement of Beijing's win.
Young volunteers wearing matching polo shirts waved the Chinese national flag and bid logos outside Beijing's iconic Bird's Nest stadium, where the 2022 opening ceremony will be held.
"I am so excited. This is China's pride," Zhang Hong, China's women's 1,000m speed skating gold medal winner at the Sochi Games, told CCTV.
"This is going to change so many people's lives," a presenter on the state broadcaster declared.