More than 150,000 people signed a petition supporting Myrtle Cothill, from South Africa, who had been ordered to fly home by the Home Office.
Mrs Cothill has been cared for by her daughter in Dorset since coming to the UK in 2014.
The government has granted limited leave to remain due to "compassionate and exceptional circumstances".
The widow, who came to the UK on a tourist visa, has heart problems, is losing her eyesight and cannot walk unaided.
She sold her house in South Africa, so she could live with her daughter Mary Willis in Poole, but did not apply for UK residency.
Mrs Cothill had been ordered to take a flight back to Johannesburg on 23 February after her case was heard by immigration tribunals, but the Home Office halted proceedings pending a medical report.
The second of her immigration tribunals had earlier concluded it was "implicit" Mrs Cothill entered the UK as a visitor "by deception" because, among other things, she disposed of her property in South Africa before leaving the country.
Immigration Minister James Brokenshire said Mrs Cothill's family had since provided further evidence about her health and fitness to travel.
He said: "I asked that this evidence be carefully considered as a fresh application under the rules.
"In the light of this assessment, I have decided that Mrs Cothill should be granted limited leave to remain in the UK with her family given the compassionate and exceptional circumstances of this case."
The decision was made on the basis that Mrs Cothill will have no recourse to public funds, including the NHS.
Mrs Cothill said the decision was "too wonderful".
She said: "I feel like a weight has been lifted off me, I want to thank everyone who has supported me. Last month has been really horrendous."
The medical report concluded there was a "considerable (and heightened) risk of mortality" within three months if Mrs Cothill returned to South Africa.
Her daughter Mary said it was the "best Mother's Day present we could have hoped for".
A 92-year-old woman facing deportation has been given permission to stay in the UK.