The HIV and AIDS (Prevention and Control) Bill, passed by the country's parliament on Tuesday, will make it illegal to discriminate against people living with and affected by HIV.
It is the first of its kind in south Asia, and will make India the largest country in the world to ban this kind of discrimination.
The legislation will make it illegal to discriminate against those living with HIV in the workplace; deny them access to education, housing and health care, or the right to stand for or hold public or private office. The legislation also bans businesses and other public places from refusing entry to anyone with HIV/AIDS.
There are also provisions where a person with HIV is not required to undergo an HIV test, medical treatment or research without their consent. An individual will also have the right to not disclose their status unless they choose to or if required by a court order.
There were more than 2.1 million people living with HIV in India in 2015, according to UNAIDS, the United Nations program which monitors global action on HIV/AIDS.
Speaking Tuesday, India's Health Minister J. P. Nadda said the bill was "historic" and promised action "against those who create hatred against HIV patients," according to the Press Trust of India.
The move was welcomed by many organizations that advocate for people living with HIV.
"This legislation begins to remove barriers and empowers people to challenge violations of their human rights," said Steve Kraus, director of the UNAIDS Regional Support Team for Asia and the Pacific.
Huidrom Rosenara, an associate director with the Delhi-based India HIV/AIDS Alliance, told CNN that "there have been many incidents of discrimination in hospitals, schools and communities."
"These incidents have decreased compared to decades ago but they still occur," she said.
"(The legislation) is a long awaited and positive move. We are very optimistic about it as it speaks volumes about the political commitment."
Long time coming
India has the highest number of people living with HIV in the Asia Pacific region, and the third highest in the world, behind South Africa
, both of which have also passed laws banning some forms of discrimination.
There were an estimated 36.7 million people living with HIV/AIDS globally in 2015, according to UNAIDS.
In India, more than 68,000 people died of AIDS that same year.
It took more than 15 years to table Tuesday's act, discussion of which first began in 2002.
The bill has received assent from both of India's houses of parliament and is awaiting presidential approval before it becomes law.
Rosenara from the India HIV/AIDS Alliance warned the law "won't change the public's mindset," but agreed it was a step in the right direction.
"It will protect the rights of people with HIV and let them lead their lives with dignity and respect," she said.