The Blairs first met the child two years ago and have been sponsoring her with a gift of pounds 15 a month, but now she is living on borrowed time.
The girl, whom reporters were asked to call Mary to protect her anonymity, was HIV-positive at birth and was abandoned by her mother, who had Aids.
Mr Blair kept hold of Mary's hand from the moment he emerged from the Nazareth House care home for a photo-call on the sunbaked lawn and play area.
While Cherie Blair played with other children, who are also suffering from the disease, Mr Blair took Mary to a climbing frame, and chatted quietly to her.
"The contribution people make is up to individuals but the means of tackling issues like this is to recognise we are living in a global community," he said.
Over 80 per cent of the world's Aids victims are in Africa, and South Africa is facing a growing epidemic of the disease, with more than 16 per cent of the population HIV-positive.
Mary is one of 40 children who are being treated with pain-killers and antibiotics, but who are not normally expected to live beyond about six years of age. The country is too poor to provide expensive maintenance drugs for Aids victims such as AZT, said a spokeswoman for the home.
The Blairs have been kept informed of Mary's progress with photographs of the child, and occasional letters. All the children at the home, which is run by nuns, have arrived through the courts. "Children with Aids don't get fostered," said the spokeswoman.
The visit highlighted the pounds 100m in funding that Britain is giving globally over the next three years towards combating Aids. Much of the help will go to South Africa, which has one of the fastest growing rates of HIV infection in the world - 1,500 new cases each day, compared with the same total each year in the UK.
It is estimated that by 2006 - when South Africa hopes to host the World Cup - more people will die from Aids than from all other causes, and there could be two million Aids orphans like Mary.
The children's home is located in an idyllic setting, under Table Mountain, on a hillside with a garden fringed by palm trees, and with a view to the Atlantic.
Mr Blair also announced a grant to the home of pounds 20,000, which will allow an extension to be built to take another 14 HIV-positive children.Reuse content