It means medical treatment can be withdrawn to hasten a person's death, if strict guidelines are followed.
This would apply to patients suffering from terminal illness and who are in a vegetative state.
A living will sets out a patient's wishes regarding how they want to be treated if they are seriously ill.
The Indian judges said the right to die with dignity was a fundamental right and that an advance directive by a person in the form of a living will could be approved by the courts.
Petitioners, who had argued that people have the right to die with dignity if they are suffering from a terminal illness, hailed the judgment.
"Today's is a landmark judgement because it comes at a time when medical science allows patients to be kept alive by artificial means and the hospitals to keep charging money," Vipul Mudgal, the head of main petitioner Common Cause, an advocacy group, told the BBC.