Objective: to estimate the prevalence and associated factors with Human Immunodeficiency Virus (HIV) infection in youths. Methods: cross-sectional study in two Centers for Testing and Counseling, with 279 youths from 15 to 24 years old. An anti-HIV test and a structured instrument were applied. We used bivariate analysis and logistic regression, with Bonferroni corrections, to investigate the association between the variables and the outcome. Results: the prevalence of HIV in the youth analyzed was 3.9% (Confidence interval - CI95%: 1.0-10.1). The association with the outcome of HIV was statistically significant in male youth (p=0.001), homosexuals (p<0.001), those who tested due to sexual exposure (p=0.034), perception of a high risk of acquiring HIV (p=0.002), and anal sex (p=0.004). Homosexual youth (odds ratio-OR=13.46; CI95%;1.14-15.84), with a perception of high risk of acquiring HIV (OR=18.11; CI95%: 2.28-143.69) had a higher chance of being HIV positive. Conclusion: the prevalence of HIV and associated factors in youth was ascertained. Contributions to practice: the information produced here shows evidence for those who aim to formulate policies, including health managers and workers. It can give support to the elaboration of strategies that involve perfecting preventive, coordinated actions, adjusted to behavioral contexts in the settings studied.