Kylie Minogue, Lulu, Deacon Blue and more than 2,000 performers brought the curtain down on what has been praised as the “best Games ever”.
Team England topped the medals table with 174, while Scotland ended up with a record 53.
Comedian Des Clarke opened the show promising to say “cheerio with the biggest party in Scotland’s history”.
Lulu, wearing a tartan scarf, then performed a rousing rendition of her first hit Shout on a huge shooting star-shaped stage in the centre of the pitch.
The athletes who took part in the Games emerged from almost 700 tents dotted throughout the stadium to a thunderous Glasgow welcome from the 40,000-strong crowd.
The behind-the-scenes workers who kept Glasgow going for the duration of the Games were then celebrated.
Deacon Blue, who formed in the city in 1985 and went on to become one of its most famous and successful bands, paid tribute to them with a rendition of their anthem, Dignity.
All in all, some 220 members of the emergency services and various council services took centre stage during the ceremony.
The workers – some on foot and some in the vehicles they use day-to-day – were led into the arena by police outriders who had taken part in the baton relay and held aloft a “Let Glasgow Flourish” banner.
Local synthpop band Prides introduced the Games volunteers – known as Clydesiders – and performed their song Messiah.
Next up were representatives of the Royal Edinburgh Military Tattoo.
The 240 massed pipes and drums from 12 international territories played ear-piercing renditions of Wi’ a Hundred Pipers and The Bloody Fields of Flanders to herald the arrival of various Commonwealth dignitaries.
Glasgow 2014 chairman Lord Smith of Kelvin paid tribute to the athletes who “gave it their all” and the Clyde-siders, whom he described as the “lifeblood” of the Games.
He said: “We’ve welcomed the world to our dear green place and it has been an experience we will never forget. Thank you Glasgow and thank you Scotland. You’ve done us proud.”
Prince Imran, of Malaysia, president of the Commonwealth Games Federation (CGF), presented an award which recognises an outstanding athlete of the Commonwealth Games.
The 2014 David Dixon Award was handed to Welsh rhythmic gymnast Frankie Jones.
Prince Imran went on to describe Glasgow 2014 as “the best Games ever”, adding: “Glasgow – you were Pure, Dead Brilliant.”
He told the crowd: “The Commonwealth Games are known as the Friendly Games. Glasgow has succeeded in making them even more than that. These have truly been the People’s Games.”
The CGF flag was lowered by two military representatives to the backdrop of Robert Burns’ Ae Fond Kiss, sung by Scottish folk singer Karen Matheson, lead singer with Capercaillie.
Michael Cavanagh, chairman of Commonwealth Games Scotland said: “As a Games family, I believe we have entertained and inspired the watching world in the last 11 days.”
Receiving the flag, Tom Tate, mayor of city of Gold Coast, said: “I am honoured to receive this flag on behalf of the people of City of Gold Coast, Australia.
“We accept this responsibility with great pride and in the spirit of the Commonwealth Games.”
Vice patron of the CGF, Prince Edward, the Earl of Wessex formally declared the Games closed.
Pop icon Kylie, then took to the stage to begin a seven-song set, starting with Spinning Around.
The ceremony rounded off with Scots singer songwriter Dougie MacLean performing his classic ballad “Caledonia” as ceremony host Des Clarke urged everyone “haste ye back” to Glasgow.
A mass performance of Auld Lang Syne featuring all of the ceremony’s performers and the thousands in the audience followed.
A Lone Piper on the stadium’s roof introduced the song, before Maclean, Lulu and Kylie joined in as the crowds crossed arms in traditional style.
The celebrations were then completed with the finale fireworks.
Closing ceremony parties were also held at the Glasgow Green and Kelvingrove Bandstand live sites – with music and entertainment and the ceremony being shown on the big screens.
The closing ceremony marks the end of an almost seven-year journey for Glasgow that began on 9 November 2007 when the city was awarded the Games.
When the dust settles on Monday, the focus will begin to turn to what legacy the sporting extravaganza has left behind and whether it was worth the time, effort and huge amount of public money spent.