BACKGROUND Employing molecular epidemiology techniques for the study of tuberculosis can afford the possibility of identifying tuberculosis transmission patterns. This study has been made for the purpose of estimating the incidence of tuberculosis related to recent transmission in Madrid and of identifying the risk factors making it possible to define transmission patterns. METHODS A three-year descriptive populational study was conducted on patients diagnosed with tuberculosis based on cultures in four districts in Madrid (550,442 inhabitants). The transmission patterns were described by means of conventional epidemiological research and molecular techniques (Restriction Fragment Length Polymorphism--RFLP--analysis with IS6110 and spoligotyping). RESULTS An RFLP analysis was conducted on 233 clinically isolated Mycobacterium tuberculosis strains, 99 (42.5%) of which were grouped into 29 clusters. The most numerous group was comprised of 134 patients infected with M. tuberculosis strains of a single RFLP pattern. These patients averaged 48.3 years of age (DE 19.4), and 17.2% were revealed to have an endogenous risk factor. Two transmission patterns were identified among the grouped cases. The first pattern included 57 patients pertaining to 23 small clusters (2-4 cases), 25 (43.9%) of which were epidemiologically linked to another case from the same cluster. The second pattern was comprised of 42 patients grouped into 6 large clusters (5 cases or more). The subjects averaged 31.4 years of age (DE 15.8), 28.6% being intravenous drug users, 31% infected with HIV, and 26.2% having a prison background. CONCLUSIONS Identifying tuberculosis transmission patterns by using molecular biology techniques affords the possibility of detecting population groups for whom preferential measures can be taken in the prevention and control programs.