Mycolic acids are attractive diagnostic markers for tuberculosis (TB) infection because they are bacteria-derived, contain information about bacterial species, modulate host–pathogen interactions and are chemically inert. Here, we present a novel approach based on mass spectrometry. Quantification of specific precursor → fragment transitions of approximately 2000 individual mycolic acids (MAs) resulted in high analytical sensitivity and specificity. We next used this tool in a retrospective case–control study of patients with pulmonary TB with varying disease burdens from South Korea, Vietnam, Uganda and South Africa. MAs were extracted from small volume sputum (200 µl) and analysed without the requirement for derivatization. Infected patients (70, 19 of whom were HIV+) could be separated from controls (40, 20 of whom were HIV+) with a sensitivity and specificity of 94 and 93%, respectively. Furthermore, we quantified MA species in lung tissue of TB-infected mice and demonstrated effective clearance of MA levels following curative rifampicin treatment. Thus, our results demonstrate for the first time the feasibility and clinical relevance of direct detection of mycobacterial lipids as biomarkers of TB infection.