The announcement by the International Olympic Committee (IOC) in Singapore was shown on a giant screen in Trafalgar Square in central London, and in the east London area where the Olympic village will be built.
"This is a truly fantastic day for east and southeast London," said Robin Wales, mayor of the east London borough of Newham, where much of the Olympics will be held.
"It is a massive opportunity and also a big responsibility."
London's bid enjoyed a late surge, ending up as one of the final two against Paris after Moscow, New York and Madrid were eliminated in voting by the International Olympic Committee.
London's proposal called for creating an Olympic stadium and village on undeveloped land in Stratford, on the eastern edge of the city.
Other venues would include London landmarks such as Wimbledon, Wembley Stadium and Regent's Park.
London plans on developing much
of the eastern edge of the city
In a report issued on 6 June, the IOC evaluation commission praised the very high quality and high level of planning of London's bid.
The only significant opposition came from about 100 small, private businesses within the planned stadium site who say relocation proposals offered by London 2012 officials are not good enough.
London has hosted the Olympics twice - in 1908 and 1948.
Britain mounted three recent unsuccessful bids, Birmingham (1992) and Manchester (1996 and 2000), but London was considered the only real potential winner.
New York was eliminated from
winning the bid in the 2nd round
London got off to a slow start but made big strides under Sebastian Coe, a two-time Olympic 1500m gold medallist who replaced American businesswoman Barbara Cassani as head of the bid in May 2004.