Tuberculosis (TB), a chronic bacterial disease caused by Mycobacterium tuberculosis, commonly affects the lung but can also affect other parts of the body (extrapulmonary tuberculosis, EPT). A rapid diagnosis is essential to initiate a specific and effective treatment. Although mycobacterial culture remains the gold standard for EPT diagnosis, molecular tools are attracting increasing interest. GeneXpert MTB/RIF, a rapid automated diagnostic test, allows the detection of Mycobacterium tuberculosis as well as mutations in the hot-spot region of the rpoB gene associated with Rifampicin resistance. The present study was performed to evaluate the performance of the GeneXpert MTB/RIF test for the diagnosis of EPT compared to the standard method. This prospective study was conducted on 304 clinical samples collected from 192 patients attending the Laboratory of Mycobacteria and Tuberculosis of Pasteur Institute of Morocco, between 2016 and 2017. Out of the 304 samples, 113 were pleural f luids decontaminated using the Petroff method and 191 were biopsies (78 lymph nodes and 113 pleural biopsies) decontaminated using the Löwenstein method. Mycobacterium tuberculosis detection and identification were performed on all samples using smear microscopy, Löwenstein–Jensen medium culture and the GeneXpert MTB/RIF test. Our results showed that 54.5 (103/189) were men and 45.5% (86/189) were women. The age of patients ranged from 2–78 years and the majority of patients was in the age group 25–45 years. Extrapulmonary samples were derived from lymph nodes, pleural f luids and pleural tissues, with a percentage of 25.66, 37.17 and 37.17%, respectively. Interestingly, the sensitivity of the GeneXpert was 51.4 for all samples and 83.3% for lymph nodes. In conclusion, the present study revealed that the performance of the GeneXpert test depends highly on the type of sample, with a high sensitivity observed for lymph nodes. Additionally, we clearly showed that the GeneXpert MTB/RIF test presents limitations in the diagnosis of pleural TB. Thus, we recommend the coupled use of the GeneXpert MTB/RIF and the conventional techniques for EPT diagnosis.