US health regulators have for the first time approved a drug to prevent HIV infection.
Truvada can be used by those at high risk of infection and anyone who may engage in sexual activity with HIV-infected partners, said the Food and Drug Administration (FDA).
Studies showed the drug reduced the risk of contracting HIV by up to 73%.
Some health workers and groups active in the HIV community opposed a green light for the once-daily pill.
There have been concerns the circulation of such a drug could engender a false sense of security and mean people will take more risks. There have also been fears that a drug-resistant strain of HIV could develop.
In a statement , the FDA stressed that the drug should be used as part of a "comprehensive HIV prevention plan", including condom use and regular HIV testing.
In May, an advisory group of health experts recommended approval for the pill.
Truvada, made by California-based Gilead Sciences, is already backed by the FDA to be taken with existing antiretroviral drugs for people who have HIV.
Studies from 2010 showed that Truvada reduced the risk of HIV in healthy gay men - and among HIV-negative heterosexual partners of HIV-positive people - by between 44% and 73%.
Michael Barton of UNAIDS, the Joint United Nations Programme on HIV/AIDS, said there was good trial evidence that the drug could significantly cut the risk of the infection being passed on, but only if the tablets are taken consistently.
Many of the men in the trials did not take the drug regularly enough to get the full protection.
He said that, in most circumstances, it would be better to treat the HIV-positive partner in the couple rather than focus on the HIV-negative one.
"We know that for HIV-positive people if they consistently take antiretroviral drugs and their viral load is suppressed for them it's almost impossible to transmit the virus."
Antiretroviral drugs will also prolong their life.
But he said the new drug might be useful in situations where, for example, a woman has a partner with HIV who is unwilling to take antiretrovirals or use condoms.
Truvada is approved in the UK for the treatment of HIV, but not prevention.