The closing ceremony offered a sensory blast including rock 'n' roll rickshaws, dustbin percussionists, an exploding yellow car and a marching band in red tunics and bearskin hats.
The Spice Girls staged a show-stopping reunion, and Monty Python's Eric Idle sauntered through "Always Look on the Bright Side of Life" - accompanied by Roman centurions, Scottish bagpipers and a human cannonball.
It all made for a psychedelic mashup that had 80,000 fans at Olympic Stadium stomping, cheering and singing along. Organizers estimated 300 million or more were watching around the world.
What a way to end a games far more successful than many Londoners expected. Security woes were overcome, and traffic nightmares never materialized. The weather held up, more or less, and British athletes overachieved.
It all came with a price tag of $14 billion - three times the original estimate. But nobody wanted to spoil the fun with such mundane concerns, at least not on this night.
"We lit the flame, and we lit up the world," said London organizing committee chief Sebastian Coe. "When our time came, Britain, we did it right."
International Olympic Committee President Jacques Rogge declared the Olympics over with praise for the athletes.
"Through your commitment to fair play, your respect for opponents, and your grace in defeat as well as in victory, you have earned the right to be called Olympians," he said, adding: "These were happy and glorious games."
But the night was about splash more than speeches.
Festive and fast-moving, the ceremony opened with pop bands Madness, Pet Shop Boys and One Direction, a shout-out to Winston Churchill and a tribute to the Union Jack - the floor of Olympic Stadium floor arranged to resemble the British flag.
Monochrome recreations of London landmarks were covered in newsprint, from Big Ben's clock tower and Tower Bridge to the London Eye ferris wheel and the chubby highrise known as the Gherkin.
Street percussion group Stomp built the noise into a frenzy, and dancers brandished brooms, in a nod to the spontaneous popular movement to clean up London after riots shook neighborhoods not far from Olympic Stadium just a year ago.
Liam Gallagher performed "Wonderwall," a 1990s hit by his former band, Oasis, Muse rocked the house with the hard-edged Olympic anthem "Survival," and Queen guitarist Brian May was joined by singer Jessie J for a crowd-pleasing "We Will Rock You."
The headline performers were each paid a pound, a little more than $1.50.
The night ended with the extinguishing of the multi-petaled Olympic cauldron and a supercharged rendition of "My Generation" and other classics by The Who that had the crowd dancing in the aisles. Confetti rained down, and fireworks lit up the sky.
Prince William's wife, Kate, and Prince Harry took seats next to Rogge. They sang along to "God Save the Queen." There was no sign of the queen herself, who made a memorable mock parachute entrance at the July 27 opening ceremony.
Following Olympic tradition, the 10,800 athletes of the London Games marched in as one rather than with their nations, symbolizing the harmony and friendship inspired by the games.
As the crowd cheered their heroes and flashbulbs rippled through the stadium, the Olympians cheered back, some carrying national flags, others snapping photographs with smartphones and cameras.
They held hands, embraced and carried each other on their shoulders, finally forming a human mosh pit on the field.
The ceremony had something for everyone, from tween girls to 1960s hippies. The face of John Lennon appeared on the stadium floor, assembled by 101 fragments of sculpture, and just as quickly gave way to George Michael, Fatboy Slim and Annie Lennox.
Eight minutes were turned over to Brazil, host of the 2016 Games in Rio de Janeiro, which delivered an explosion of samba, sequins and Latin cool. Following tradition, the mayor of London handed the Olympic flag off to his Rio counterpart.
Britons, who had fretted for weeks that the games would become a fiasco, were buoyed by their biggest medal haul since 1908 - 29 golds and 65 medals in all.
The United States edged China in both the gold medal and total medal standings, eclipsing its best performance at an Olympics on foreign soil after the Dream Team narrowly held off Spain in basketball for the country's 46th gold.
While the games may have lacked some of the grandeur of the Beijing Olympics in 2008, there were more than a few unforgettable moments.
Jamaican sprinter Usain Bolt became an Olympic legend by repeating as champion in both the 100-meter and 200-meter sprints. Michael Phelps ended his long career as the most decorated Olympian in history.
British distance runner Mo Farah became a national treasure by sweeping the 5,000- and 10,000-meter races, and favorite daughter Jessica Ennis became a global phenomenon with her victory in the heptathlon.
Female athletes took center stage in a way they never had before. American gymnast Gabby Douglas soared to gold, the U.S. soccer team made a dramatic march to the championship. Packed houses turned out to watch the new event of women's boxing. And women competed for Saudi Arabia, Qatar and Brunei for the first time.
And then there was Oscar Pistorius, the double-amputee from South Africa running on carbon-fiber blades, who didn't win a medal but nonetheless left a champion. And sprinter Manteo Mitchell, who completed his leg of the 4x400 relay semifinal on a broken leg, allowing his team to qualify and win silver.
Britons seemed exhausted and exhilarated after two glorious weeks in the world's spotlight, and just months after the country celebrated the queen's 60th year on the throne with a magnificent pageant and street parties.
Some at Olympic Park acknowledged happy surprise that not much had gone wrong, and so much had gone right.
"I was a bit worried we wouldn't be able to live up to it," said Phil Akrill of Chichester. "But walking around here it's just unbelievable."
Even non-Brits were proud of their adopted homeland.
"It's just been a really nice thing to see," said Anja Ekelof, a Swede who now lives in Scotland. "The whole country has come together."
Associated Press writers Fergus Bell and Jill Lawless contributed to this report.