London bade farewell to the Olympic Games with a high-octane romp through British pop music, bringing the curtain down on more than two weeks of action.
There was another sellout crowd at the 80,000-capacity athletics stadium in East London for the final act of the tournament, and another 300 million people were expected to tune in on television sets around the world.
Actor Timothy Spall read from Shakespeare's "The Tempest" dressed as war-time Prime Minister Winston Churchill.
And after a London "rush hour" featuring real cars and trucks, Prince Harry entered to represent his grandmother Queen Elizabeth II.
Boy band One Direction, the Pet Shop Boys and Madness were among the early acts in an exuberant finale that sought to sum up Britain's enthusiasm for the Games despite earlier reservations about the £9bn cost.
In the centre of the stage, reconstructions of famous London landmarks such as St Paul's Cathedral and Tower Bridge provided the backdrop for a "street party", recalling nationwide celebrations this summer marking the queen's Diamond Jubilee.
They were then removed to allow thousands of athletes to enter to the strains of Elbow before the music took off with hit after hit accompanied by a spectacular light show created by innovative "pixel boxes" installed on each seat.
The Spice Girls, Muse and The Who also performed.
The stadium was the setting for some of the most spectacular moments of the Games, including Jamaican sprint king Usain Bolt defending the 100, 200 and 4x100 metres titles he won in Beijing, the latter in a world-beating time.
British supporters will also cherish memories of the venue, where Somali-born runner Mo Farah won the 5,000 and 10,000 double to deafening roars and was celebrated as a symbol of the capital's multi-culturalism.
The host nation won 29 golds to take third place in the rankings, its best result for 104 years, which helped lift the nation out of the gloom of an economic recession temporarily buried in the inside pages of the newspapers.
"I will say history has been written by many athletes. The Games were absolutely fabulous. London has absolutely refreshed the Games," International Olympic Committee President Jacques Rogge told reporters.
US President Barack Obama called British Prime Minister David Cameron to congratulate Britain on what he called "an extremely successful Olympic games, which speaks to the character and spirit of our close ally".