The contraceptive gel remains in liquid form while in contact with acidity levels normally found in the vagina.
But the vaginal condom becomes solid and traps sperm, when it encounters semen, which is slightly alkaline.
Furthermore, any particles wider than 50 nanometres, which include the HIV, herpes and papilloma viruses, would also be trapped.
This means the gel is both a protectant and contraceptive and provides a cheap way to protect women in the Third World from pregnancy and HIV.
Patrick Kiser, and assistant professor at the University of Utah in Salt Lake City, whose team has helped develop the gel, says clinical trials could begin in as little as three years.
"We did it to develop technologies that can enable women to protect themselves against HIV without the approval of their partner," he said.
The gel has only been tested in the lab so far but Dr Kiser, whose research was published in New Scientist, and his team have already proved it can trap HIV by staining virus particles with a fluorescent dye.
He is also hoping to improve the gel by impregnating it with an anti-HIV drug which would kill the virus after it has solidified.