The 94-year-old was admitted on 27 March for a recurring infection of the lungs and had fluid drained from them, the BBC reports.
The presidency statement read that Mandela was discharged from hospital on 6 April following a sustained and gradual improvement in his general condition.
Mandela is clearly in better health than he was 10 days ago, but the former South African president is not out of the woods yet.
He will continue to receive high-level care at his home in Houghton, Johannesburg.
South Africans welcomed the news of Mandela's release. His latest stay in hospital was his fourth in two years.
In December, the ex-leader spent 18 days undergoing treatment for a lung infection and gallstones - his longest period in hospital since leaving prison in 1990.
In February, he was treated for a stomach condition.