"This morning [Saturday] the former president underwent a procedure via endoscopy to have the gallstones removed," spokesperson Mac Maharaj said in a statement.
"The procedure was successful and Madiba is recovering. The medical team decided to attend to a lung infection before determining when to attend to the gallstones."
Maharaj said tests done after Mandela was hospitalised on December 8 revealed a recurrence of the lung infection and that he had developed gallstones.
He said doctors gave no indication when he would be discharged.
Mandela (94) was flown to Pretoria from his home in Qunu, in the Eastern Cape.
Mandela's hospital stay is his longest continuous period in hospital since 2001, when he underwent seven weeks of radiotherapy after being diagnosed with prostate cancer. He was 83 at the time.
In January 2011, Mandela was admitted to a Johannesburg hospital for an acute respiratory infection. He had contracted tuberculosis while in prison.
Eyewitness News reported on Thursday that Mandela was not receiving treatment at One Military Hospital at the Thaba Tshwane Military Base in Pretoria as had been widely reported after Defence Minister Nosiviwe Mapisa-Nqakula's interview on Monday.
Mapisa-Nqakula spoke to reporters outside the hospital after seemingly visiting Mandela there.
Since Friday morning, the number of journalists kept increasing at Mediclinic Heart Hospital in Pretoria as details of the reported new hospital filtered through.
The presidency said it had not been the government's intention to mislead the public or the media.
Maharaj said he had only stated Mandela had been admitted to a Pretoria hospital.
"It is not part of any strategy or tactic by government to mislead the public. We have never had that intention. We know to keep to the facts and we've been rigorous," he said in an interview on Talk Radio 702. – Sapa.