Tenor Placido Domingo was on hand, joining a Chinese soprano in a lyrical duet. Soccer icon David Beckham and graying Led Zeppelin guitarist Jimmy Page were there, helping London take the reins as host-to-be of the 2012 Games.
Yet even as the International Olympic Committee was praising itself for awarding Beijing these Olympics, the U.S. Embassy urged China to free foreign activists jailed for protesting at the Games. China, the embassy suggested, should have used its moment in the global spotlight to show "greater tolerance and openness."
China nonetheless achieved its paramount goals: a dominant effort by its athletes to top the gold-medal standings for the first time and near-flawless organizing that showcased world-class venues and smiling volunteers to the largest-ever peaceful influx of foreign visitors.
As a bonus, not just one but two athletes gave arguably the greatest performances in Olympic history - Michael Phelps with his eight gold medals in swimming, and Jamaica's effervescent Usain Bolt with three golds and three world records in the sprints.
Delighted with the on-field competition, the IOC insisted its much-debated selection of Beijing back in 2001 had been vindicated.
"Tonight, we come to the end of 16 glorious days which we will cherish forever," IOC President Jacques Rogge told the capacity crowd of 91,000 at the National Outdoor Stadium, and a global TV audience. "Through these Games, the world learned more about China, and China learned more about the world."
"These were truly exceptional Games," he said, before declaring them formally closed.
The head of the Beijing organizing committee, Liu Qi, said the Games were "testimony to the fact that the world has rested its trust in China." He called them "a grand celebration of sport, of peace and friendship."
Before and during the Games, Rogge and the IOC were criticized by human rights groups for their reluctance to publicly challenge the Chinese as various controversies arose over press freedom and detention of dissidents. Athletes shied away from making political statements, and "protest zones" established in Beijing went unused as the authorities refused to issue permits for them and detained some of the applicants.
But the atmosphere was festive at the stadium as fireworks burst from its top rim - and from locations across the vast capital city - to begin the closing ceremony. After an army band played the Chinese national anthem, swarms of gaily dressed dancers, acrobats and drummers swirled onto the field, then made room for the athletes, strolling in casually and exuberantly from four different entrances.
Two-thirds of the way through the ceremony came the pulsating show-within-a-show by London, complete with break dancing, hip hop and ballet. From a stage formed from a red double-decker bus, Page played the classic rock hit "Whole Lotta Love" as British pop sensation Leona Lewis belted out the lyrics. Beckham, in a stylish black sweat suit, booted a soccer ball into the surrounding throng of athletes on the stadium floor.
Former Olympic runner Sebastian Coe, now chairman of the London organizing committee, was elated.
"What we have witnessed in Beijing is a truly spectacular Olympic Games," he said. "We have a once-in-a-lifetime opportunity to build on this moment."
After the Britons relinquished the spotlight, the Olympic flame atop the stadium was extinguished. A carnival-themed segment completed the show, featuring a duet by Domingo and Chinese soprano Song Zuying. There was another, noisier barrage of fireworks and confetti filled the air.
China invested more than $40 billion in the Games, which it viewed as a chance to show the world its dramatic economic progress. Olympic telecasts achieved record ratings in China and the United States, and the Games' presence online was by far the most extensive ever.
Rogge said these Olympics would leave a lasting, positive legacy for China - improved transportation infrastructure, more grass-roots interest in recreational sports, a more aggressive approach to curbing air pollution and other environmental problems. Smog that enveloped the city early in the Games gave way to mostly clear skies, easing fears that some endurance events might be hazardous for the athletes.
American rower Jennifer Kaido of West Leyden, N.Y., said the Games exceeded her expectations.
"We were prepared for smog, pollution, demonstrations, but everything has gone very smoothly," she said.
Rogge acknowledged that China, despite promises of press freedom during the Games, continued to block access to numerous politically oriented Web sites, including those related to Tibet and the outlawed spiritual movement Falun Gong.
However, he contended that media restrictions were looser during the Olympics than beforehand, "and so we believe the Games had a good influence."
Human rights groups disagreed.
"The reality is that the Chinese government's hosting of the games has been a catalyst for abuses, leading to massive forced evictions, a surge in the arrest, detention and harassment of critics, repeated violations of media freedom, and increased political repression," said Sophie Richardson of Human Rights Watch. "Not a single world leader who attended the Games or members of the IOC seized the opportunity to challenge the Chinese government's behavior in any meaningful way."
Led by Phelps and Bolt, athletes broke 43 world records and 132 Olympic records during the Games. Yet Rogge, who visited every venue, said the most touching moment for him came after the 10-meter air pistol event, when gold medalist Nino Salukvadze of Georgia embraced runner-up Natalia Paderina of Russia even as their two countries' armies fought back in Georgia.
"That kind of sportsmanship is really remarkable," Rogge said.