Molecular epidemiology of circulating clinical isolates is crucial to improve prevention strategies. The Spanish Working Group on multidrug resistant tuberculosis (MDR-TB) is a network that monitors the MDR-TB isolates in Spain since 1998. The aim of this study was to present the study of the MDR-TB and extensively drug-resistant tuberculosis (XDR-TB) patterns in Spain using the different recommended genotyping methods over time by a national coordinated system. Based on the proposed genotyping methods in the European Union until 2018, the preservation of one method, MIRU-VNTR, applied to selected clustered strains permitted to maintain our study open for 20 years. The distribution of demographic, clinical and epidemiological characteristics of clustered and non-clustered cases of MDR/XDR tuberculosis with proportion differences as assessed by Pearson's chi-squared or Fisher's exact test was compared. The differences in the quantitative variables using the Student's-t test and the Mann-Whitney U test were evaluated. The results obtained showed a total of 48.4% of the cases grouped in 77 clusters. Younger age groups, having a known TB case contact (10.2% vs 4.7%) and XDR-TB (16.5% vs 1.8%) were significantly associated with clustering. The largest cluster corresponded to a Mycobacterium bovis strain mainly spread during the nineties. A total of 68.4% of the clusters detected were distributed among the different Spanish regions and six clusters involving 104 cases were grouped in 17 and 18 years. Comparison of the genotypes obtained with those European genotypes included in The European Surveillance System (TESSy) showed that 87 cases had become part of 20 European clusters. The continuity of MDR strain genotyping in time has offered a widespread picture of the situation that allows better management of this public health problem. It also shows the advantage of maintaining one genotyping method over time, which allowed the comparison between ancient, present and future samples.