His prison number was 46664 - that's how the campaign got its name.
The five-hour gig on Saturday was shown on the campaign's website - www.46664.com
More than 30,000 people packed into Cape Town's Greenpoint Stadium to watch the gig, which also featured video messages from famous faces including LOTR star Sir Ian McKellen.
The biggest cheer of the night went to 85-year-old Mr Mandela.
The event came ahead of World Aids Day on Monday.
It's estimated that up to 46 million people around the world are infected with HIV.