The Xpert MTB/RIF test (Cepheid, Sunnyvale, CA, USA) can detect tuberculosis and its multidrug-resistant form with very high sensitivity and specificity in controlled studies, but no performance data exist from district and subdistrict health facilities in tuberculosis-endemic countries. We aimed to assess operational feasibility, accuracy, and effectiveness of implementation in such settings. We assessed adults (≥18 years) with suspected tuberculosis or multidrug-resistant tuberculosis consecutively presenting with cough lasting at least 2 weeks to urban health centres in South Africa, Peru, and India, drug-resistance screening facilities in Azerbaijan and the Philippines, and an emergency room in Uganda. Patients were excluded from the main analyses if their second sputum sample was collected more than 1 week after the first sample, or if no valid reference standard or MTB/RIF test was available. We compared one-off direct MTB/RIF testing in nine microscopy laboratories adjacent to study sites with 2-3 sputum smears and 1-3 cultures, dependent on site, and drug-susceptibility testing. We assessed indicators of robustness including indeterminate rate and between-site performance, and compared time to detection, reporting, and treatment, and patient dropouts for the techniques used. We enrolled 6648 participants between Aug 11, 2009, and June 26, 2010. One-off MTB/RIF testing detected 933 (90·3) of 1033 culture-confirmed cases of tuberculosis, compared with 699 (67·1) of 1041 for microscopy. MTB/RIF test sensitivity was 76·9 in smear-negative, culture-positive patients (296 of 385 samples), and 99·0 specific (2846 of 2876 non-tuberculosis samples). MTB/RIF test sensitivity for rifampicin resistance was 94·4 (236 of 250) and specificity was 98·3 (796 of 810). Unlike microscopy, MTB/RIF test sensitivity was not significantly lower in patients with HIV co-infection. Median time to detection of tuberculosis for the MTB/RIF test was 0 days (IQR 0-1), compared with 1 day (0-1) for microscopy, 30 days (23-43) for solid culture, and 16 days (13-21) for liquid culture. Median time to detection of resistance was 20 days (10-26) for line-probe assay and 106 days (30-124) for conventional drug-susceptibility testing. Use of the MTB/RIF test reduced median time to treatment for smear-negative tuberculosis from 56 days (39-81) to 5 days (2-8). The indeterminate rate of MTB/RIF testing was 2·4 (126 of 5321 samples) compared with 4·6 (441 of 9690) for cultures. The MTB/RIF test can effectively be used in low-resource settings to simplify patients' access to early and accurate diagnosis, thereby potentially decreasing morbidity associated with diagnostic delay, dropout and mistreatment. Foundation for Innovative New Diagnostics, Bill & Melinda Gates Foundation, European and Developing Countries Clinical Trials Partnership (TA2007.40200.009), Wellcome Trust (085251/B/08/Z), and UK Department for International Development.