In countries with a high incidence of HIV and tuberculosis co-infection, nevirapine and efavirenz are widely used as antiretroviral therapy but both interact with antituberculosis drugs. We aimed to compare efficacy and safety of a nevirapine-based antiretroviral therapy (started at full dose) with an efavirenz-based regimen in co-infected patients. We did a multicentre, open-label, randomised, non-inferiority trial at three health centres in Maputo, Mozambique. We enrolled adults (≥18 years) with tuberculosis and previously untreated HIV infection (CD4 cell counts <250 cells per μL) and alanine aminotransferase and total bilirubin concentrations of less than five times the upper limit of normal. 4-6 weeks after the start of tuberculosis treatment, we randomly allocated patients (1:1) with central randomisation, block sizes of two to six, and stratified by site and CD4 cell count to nevirapine (200 mg twice daily) or efavirenz (600 mg once daily), plus lamivudine and stavudine. The primary endpoint was virological suppression at 48 weeks (HIV-1 RNA <50 copies per mL) in all patients who received at least one dose of study drug (intention-to-treat population); death and loss to follow-up were recorded as treatment failure. The non-inferiority margin for the difference of efficacy was 10%. We assessed efficacy in intention-to-treat and per-protocol populations and safety in all patients who received study drug. This study is registered with ClinicalTrials.gov, number NCT00495326. Between October, 2007, and March, 2010, we enrolled 285 patients into each group. 242 (85%) patients in the nevirapine group and 233 (82%) patients in the efavirenz group completed follow-up. In the intention-to-treat population, 184 patients (64·6%, 95% CI 58·7-70·1) allocated nevirapine achieved virological suppression at week 48, as did 199 patients (69·8%, 64·1-75·1) allocated efavirenz (one-sided 95% CI of the difference of efficacy 11·7%). In the per-protocol population, 170 (70·0%, 63·8-75·7) of 243 patients allocated nevirapine achieved virological suppression at week 48, as did 194 (78·9%, 73·2-83·8) of 246 patients allocated efavirenz (one-sided 95% CI 15·4%). The median CD4 cell count at randomisation was 89 cells per μL. 15 patients substituted nevirapine with efavirenz and six patients substituted efavirenz with nevirapine. 20 patients allocated nevirapine (7%) had grade 3-4 increase of alanine aminotransferase compared with 17 patients allocated efavirenz (6%). Three patients had severe rash after receipt of nevirapine (1%) but no patients did after receipt of efavirenz. 18 patients in the nevirapine group died, as did 17 patients in the efavirenz group. Although non-inferiority of the nevirapine-regimen was not shown, nevirapine at full dose could be a safe, acceptable alternative for patients unable to tolerate efavirenz. French Research Agency for HIV/AIDS and hepatitis (ANRS).