JOHANNESBURG (AP) — Nelson Mandela waved to the crowd at Soccer City as South Africa bid farewell to the 2010 World Cup in emotional and joyous ceremony on Sunday.

The 91-year-old anti-apartheid icon had kept a low profile during the monthlong tournament, deciding against attending the opener June 11 after the death of his great-grand daughter in a traffic accident following a World Cup concert.

Driven in a small golf cart and seated alongside wife, Graca Machel, the smiling, warmly dressed 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.

Earlier, Shakira performed "Waka Waka" ("This Time for Africa",) the competition's official song.

Also performing 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 colors of the 32 competing nations performed before a backdrop of pictures of stars and fans beamed onto the field. Performers dressed in white elephant costumes made their way onto the field toward a 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 created 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 large, upbeat crowds.