The US and China ended the games with 40 gold medals each, but the US topped the table because it had more silver medals.
Hollywood star Tom Cruise abseiled from the roof of the Stade de France drawing gasps from spectators as Paris bade farewell to an Olympics hailed as one of the most successful.
Cruise descended on a wire in front of 71,500 people, grabbed the Olympic flag and jumped on a motorbike, to the delight of athletes and fans.
In a preview of what the world can expect when the next event is held in Los Angeles in 2028, the 62-year-old Mission Impossible star was then shown on a screen boarding a plane and skydiving into the Californian city before adorning the iconic Hollywood sign with the Olympic rings.
Los Angeles band Red Hot Chili Peppers, singer Billie Eilish and rappers Snoop Dogg and Dr Dre then performed a mini-concert on an LA beach framed by the Pacific Ocean.
The closing spectacle marked the beginning of the four-year countdown to the LA Games, and American gymnastics icon Simone Biles joined Los Angeles Mayor Karen Bass as the Olympic flag was formally handed over.
Earlier, International Olympic Committee president Thomas Bach described the Paris Games as “sport at its best”.
“These were sensational Olympic Games from start to finish,” Bach said. “Or dare I say: Seine-sational Games,” the IOC chief quipped about the Seine River where the opening ceremony unfolded and the triathlon and marathon swimming events took place.
At what will be Bach’s last games after announcing his intention to step down next year, the IOC chief also called for ”a culture of peace” in a war-torn world.
“We know that the Olympic Games cannot create peace, but the Olympic Games can create a culture of peace that inspires the world,” he said. “Let us live this culture of peace every single day.”