Spectators at the Fisht Stadium in the Olympic Park, including Russia president Vladimir Putin, took in a show which focused on the art, music, dance and literature of the host nation.
It also featured the traditional athletes' parade and extinguishing of the Olympic flame, plus the official handover to 2018 hosts PyeongChang.
And there was a notable light-hearted moment in the proceedings as well when the infamous Olympic rings malfunction from the opening ceremony was parodied by a group of dancers.
During his speech later on in the evening, Sochi 2014 organising committee president Dmitry Chernyshenko spoke of the "the new face of Russia" that had been showcased by the Games.
International Olympic Committee (IOC) president Thomas Bach then made a speech, in which he thanked Sochi, Russia and, in particular, the athletes, who he suggested had delivered "a message of a society of peace, tolerance and respect" with the community they had formed at the event.
A major talking point in the build-up to and duration of these Olympics has been Russia's hard-line laws on ''non-traditional'' sexuality, widely seen as an attack on gay rights.
And addressing the athletes, Bach said: "By living together under one roof in the Olympic Village you send a powerful message from Sochi to the world: the message of a society of peace, tolerance and respect.
"I appeal to everybody implicated in confrontation, oppression or violence: act on this Olympic message of dialogue and peace.
"We all have enjoyed exceptional conditions in these Olympic Winter Games.
"Our Russian hosts had promised excellent sports venues, outstanding Olympic Villages and an impeccable organisation.
"Tonight we can say: Russia delivered all what it had promised."
The Sochi Olympics have cost Russia a reported £30million to stage and there was plenty of evidence of money having been spent at the lavish opening ceremony, also at the Fisht Stadium, which officially got the Games under way on February 7.
An isolated hiccup in that show had been a technical glitch that led to one of five electronic snowflakes, brought together in mid-air as they turned into rings to form the Olympic symbol, failing to do so properly.
The incident was widely viewed as an embarrassment on Russia's part, but it was recreated early on in Sunday's production by dancers in sparkly outfits on the stadium floor, with one cluster taking longer than the other four to open out into a circle.
By that stage there had already been a highlights reel shown on big screens of the sporting action that had taken place between the two shows and ended with Russia at the top of the medal table.
Soon after, those who had competed emerged for the parade, with skeleton champion Lizzy Yarnold bearing the flag at the head of the Great Britain party and the hosts being led by Maxim Trankov, who, along with partner Tatiana Volosozhar, had earned gold medals in both the pairs and team figure skating events.
The awarding of medals was then completed with the gold, silver and bronzes being handed out for the women's 30 kilometre and men's 50 kilometre cross-country skiing events - the latter being a clean sweep for Russia - before Norwegian biathlete Ole Einar Bjoerndalen and Canadian ice hockey player Hayley Wickenheiser were officially sworn in as members of the IOC athletes' commission.
A celebration of the Russian arts followed, featuring a version of Rachmaninoff's Piano Concerto No 2, tributes to the work of Kandinsky, Tolstoy and Chekhov and sequences focusing on the ballet and the circus.
The handover ceremony then took place, with the Olympic flag being passed from the mayor of Sochi to his PyeongChang counterpart and the 2018 hosts contributing their own performance to the evening.
After the speeches, in which Bach declared the Games officially closed, giant versions of the official mascots congregated in the middle of the stadium around a flame and blew it out, simultaneous to the one in the cauldron outside also being extinguished.
The Sochi extravaganza had reached its end, but memories of Putin's Olympic party will live on for some time.