HIV prevalence is rising, especially among high risk females in Tijuana, Baja California, a Mexico-US border city situated on major migration and drug trafficking routes. We compared factors associated with HIV infection among male and female injection drug users (IDUs) in Tijuana in an effort to inform HIV prevention and treatment programs. IDUs aged > or = 18 years were recruited using respondent-driven sampling and underwent testing for HIV, syphilis and structured interviews. Logistic regression identified correlates of HIV infection, stratified by gender. Among 1056 IDUs, most were Mexican-born but 67% were born outside Tijuana. Reasons for moving to Tijuana included deportation from the US (56% for males, 29% for females), and looking for work/better life (34% for females, 15% for males). HIV prevalence was higher in females versus males (10.2% vs. 3.5%, p = 0.001). Among females (N = 158), factors independently associated with higher HIV prevalence included younger age, lifetime syphilis infection and living in Tijuana for longer durations. Among males (N = 898), factors independently associated with higher HIV prevalence were syphilis titers consistent with active infection, being arrested for having 'track-marks', having larger numbers of recent injection partners and living in Tijuana for shorter durations. An interaction between gender and number of years lived in Tijuana regressed on HIV infection was significant (p = 0.03). Upon further analysis, deportation from the U.S. explained the association between shorter duration lived in Tijuana and HIV infection among males; odds of HIV infection were four-fold higher among male injectors deported from the US, compared to other males, adjusting for all other significant correlates (p = 0.002). Geographic mobility has a profound influence on Tijuana's evolving HIV epidemic, and its impact is significantly modified by gender. Future studies are needed to elucidate the context of mobility and HIV acquisition in this region, and whether US immigration policies adversely affect HIV risk.