We conducted a survival analysis with competing risks to estimate the mortality rate and predictive factors for immunodeficiency-related death in people living with HIV/AIDS (PLWH) in northeast Brazil. A cohort with 2372 PLWH was enrolled between July 2007 and June 2010 and monitored until 31 December 2012 at two healthcare centres. The event of interest was immunodeficiency-related death, which was defined based on the Coding Causes of Death in HIV Protocol (CoDe). The predictor variables were: sociodemographic characteristics, illicit drugs, tobacco, alcohol, nutritional status, antiretroviral therapy, anaemia and CD4 cell count at baseline; and treatment or chemoprophylaxis for tuberculosis (TB) during follow-up. We used Fine & Gray's model for the survival analyses with competing risks, since we had regarded immunodeficiency-unrelated deaths as a competing event, and we estimated the adjusted sub-distribution hazard ratios (SHRs). In 10 012·6 person-years of observation there were 3·1 deaths/100 person-years (2·3 immunodeficiency-related and 0·8 immunodeficiency-unrelated). TB (SHR 4·01), anaemia (SHR 3·58), CD4 <200 cells/mm3 (SHR 3·33) and being unemployed (SHR 1·56) were risk factors for immunodeficiency-related death. This study discloses a 13% coverage by highly active antiretroviral therapy (HAART) in our state and adds that anaemia at baseline or the incidence of TB may increase the specific risk of dying from HIV-immunodeficiency, regardless of HAART and CD4.