To determine the effect of contemporary clinical care on the natural history of opportunistic disease in an urban population infected with human immunodeficiency virus (HIV). Urban university HIV clinic. Retrospective and prospective observational study. 1246 HIV-infected patients with CD4+ counts of 300 cells/mm3 or less. Incidence rates and Kaplan-Meier estimates of the probability of developing opportunistic disease with time, distribution of the CD4+ counts at which opportunistic disease develops, survival after the development of opportunistic disease, and the association between preventive drug therapies and the occurrence of opportunistic infection. The most common opportunistic disease was Candida esophagitis, which had an incidence of 13.3 events per 100 person-years and a 3-year Kaplan-Meier probability of 0.30. Pneumocystis carinii pneumonia, Mycobacterium avium complex bacteremia, cytomegalovirus, and the acquired immunodeficiency syndrome dementia complex occurred at rates of 5 to 9 events per 100 person-years and 3-year Kaplan-Meier probabilities of 0.15 to 0.22. Toxoplasmosis, cryptococcal meningitis, herpes zoster, the wasting syndrome, and Kaposi sarcoma occurred at rates of about 2 to 4 events per 100 person-years and with 3-year Kaplan-Meier probabilities of 0.05 to 0.10. Non-Hodgkin lymphoma, M. tuberculosis infection, progressive multifocal leukoencephalopathy, and cryptosporidiosis were the least common disorders, with an incidence of about 1 to 2 events per 100 person-years and a 3-year Kaplan-Meier probability less than 0.05. Only the incidences of cryptococcal meningitis, secondary P. carinii pneumonia, and herpes zoster decreased (P < 0.05) between 1989-1992 and 1993-1995. Fluconazole use was associated with a decreased relative rate of 0.49 (P = 0.06) for cryptococcal meningitis and a decreased relative rate of 0.61 (P = 0.005) for esophageal candidiasis. Rifabutin use was associated with a decreased relative rate of 0.37 (P = 0.002) for M. avium complex bacteremia, and trimethoprim-sulfamethoxazole use was associated with decreased relative rates of 0.33 (P = 0.02) for secondary P. carinii pneumonia and 0.55 (P = 0.08) for primary P. carinii pneumonia. Candidiasis, herpes zoster, and M. tuberculosis infection first occurred at a median CD4+ count greater than 100 cells/mm3, but all other opportunistic diseases first occurred at a median CD4+ count less than 50 cells/mm3. Median survival after diagnosis varied from 35 days for non-Hodgkin's lymphoma to 680 days for herpes zoster. In the patients studied, the incidences of secondary P. carinii pneumonia, cryptococcal meningitis, and herpes zoster have declined in the past 5 years. The incidences of primary P. carinii pneumonia and Kaposi sarcoma appear to be declining compared with historical estimates. However, although these and other opportunistic diseases continue to be relatively frequent complications of HIV infection, they are first occurring at more advanced immunosuppression than in the past. Continued efforts are needed to develop effective strategies for preventing opportunistic disease in very advanced HIV infection.