A "biosensor" developed by scientists of the Spanish National Research Council (CSIC) detects the p24 antigen, a protein attached to the HIV virus, in human blood, the council said in a statement.
The technology "detects the protein at concentrations 100,000 times lower than in current techniques," it said, and "during the first week after infection."
"In addition, the total test time is four hours, 45 minutes, meaning clinical results could be obtained on the same day."
The outcome of tests with the sensor was published this week in the science journal PLOS ONE.
The sensor is a rice grain-sized chip combining micro-mechanical silicon structures and gold nanoparticles.
Its ingredients are manufactured using existing tecnology, "thus making large-scale, low-cost production possible," CSIC researcher Javier Tamayo said a statement.
"This, combined with its simplicity, could make it a great choice for use in developing countries" hardest-hit by the scourge of HIV.
Current antigen tests can detect HIV only about three weeks after infection. Tests that pick up HIV antibodies in the blood require an even longer wait.
RNA tests can detect the virus directly after about 10 days, but are more expensive.
Early detection is crucial to stop an infected person unknowingly passing the virus on to other people through sex.
According to the World Health Organization, there were about 36.7 million people living with HIV in 2015, mainly in low- and middle-income countries.
An estimated 2.1 million people were infected in 2015.
Some 35 million people have died from HIV-related causes, including 1.1 million in 2015.