Nelson Mandela waved to the crowd and Shakira had fans dancing in their seats as South Africa began saying farewell to the 2010 World Cup in emotional and pulsating fashion.

The anti-apartheid icon had kept a low profile during the month-long tournament, having decided against attending the opening game following the death of his great-grand daughter.

Driven in a small golf cart alongside wife Graca Machel, a smiling Mr. Mandela was welcomed by a thunderous mix of vuvuzelas and roars from the crowd. He shook hands with officials before leaving the field a few minutes later.

Shakira, backed by South African Afro-fusion band Freshlyground, did one last rendition of the cup’s theme tune, “Waka Waka (This Time for Africa)” after a lights show and fireworks.

Also performing Sunday was Grammy Award-winning cappella group Ladysmith Black Mambazo.

The ceremony was attended by heads of state from across Africa, including South Africa’s Jacob Zuma and Zimbabwe’s Robert Mugabe.

Dutch and Spanish royals were also present, as were Archbishop Desmon Tutu and former U.N. Secretary-General Kofi Annan. They were rubbing shoulders with the likes of model Naomi Campbell, tennis star Rafael Nadal and Oscar-winning actor Morgan Freeman.

Dancers wearing the colours of the 32 competing nations performed before a backdrop of pictures of stars and fans beamed onto the pitch; others dressed in white elephant costumes made their way onto the field toward large image of a watering hole.

Themes included pantsula and gumboot dancing and local jazz — all touchstones of South African music.

Dutch and Spanish fans led a carnival atmosphere before the match, embracing police officers outside the stadium and posing for photographs while blowing vuvuzelas, the horn whose sound has become synonymous with the 2010 tournament.

Some had doubted South Africa’s ability to stage a successful tournament, but the matches were played before mostly capacity — and joyous — crowds. The competition, the first to be held in Africa, was free of any major incidents.