Background: In the era of highly active antiretroviral therapy (HAART), it remains unclear whether human immunodeficiency virus (HIV)-infected injection drug users (IDUs) have durations of survival similar to those for comparable HIV-uninfected IDUs. The goal of this study was to compare survival durations of HIV-infected and HIV-uninfected IDUs for the period 1987-2004.Methods. Demographic data, drug use characteristics, and biological markers were obtained at the time of admission to a substance abuse treatment program. The outcome of interest was the duration of survival after admission, and the primary exposure was HIV infection. Vital status was ascertained by means of the mortality register by the end of 2004. Three calendar periods, which were defined on the basis of use of specific therapies, were considered: 1987-1991 (the antiretroviral monotherapy era), 1992-1996 (the dual combination therapy era and the era when methadone was introduced in Spain), and 1997-2004 (the era of HAART and of established methadone programs). We used Cox regression methods allowing for late entries to handle the contribution of persons who survived a given period and entered the following period with nonzero time. We compared HIV-uninfected and HIV-infected IDUs with adjustments for age, sex, and duration of follow-up after admission., Results: A total of 1209 IDUs were admitted to the hospital during the period from January 1987 through December 2004, and 1181 were eligible for the study. The majority (81.3%) of patients were men. The mean age (+/- standard deviation) at admission was 27.8+/-5.6 years, and the mean duration of injection drug use (+/- standard deviation) was 7.6+/-5.0 years. The prevalences of HIV and hepatitis C virus infections were 59.0% and 92.3%, respectively, and the total duration of follow-up was 10.116 person-years. Although survival duration for HIV-uninfected IDUs in 1997-2004 was similar to the duration in earlier periods, the duration for HIV-infected IDUs improved significantly since 1997 (P<.01). Furthermore, among patients admitted in the last period, the survival durations for HIV-uninfected and HIV-infected IDUs was virtually the same (relative hazard, 0.89; 95% confidence interval, 0.44-1.81)., Conclusions: The duration of survival of HIV-infected IDUs has improved substantially since 1997, reaching rates similar to the rates for HIV-seronegative IDUs who accessed the health care system in the era of HAART.