Immigrants from high-burden countries and HIV-coinfected individuals are risk groups for tuberculosis (TB) in countries with low TB incidence. Therefore, we studied their role in transmission of Mycobacterium tuberculosis in Switzerland. We included all TB patients from the Swiss HIV Cohort and a sample of patients from the national TB registry. We identified molecular clusters by spoligotyping and mycobacterial interspersed repetitive-unit-variable-number tandem-repeat (MIRU-VNTR) analysis and used weighted logistic regression adjusted for age and sex to identify risk factors for clustering, taking sampling proportions into account. In total, we analyzed 520 TB cases diagnosed between 2000 and 2008; 401 were foreign born, and 113 were HIV coinfected. The Euro-American M. tuberculosis lineage dominated throughout the study period (378 strains; 72.7%), with no evidence for another lineage, such as the Beijing genotype, emerging. We identified 35 molecular clusters with 90 patients, indicating recent transmission; 31 clusters involved foreign-born patients, and 15 involved HIV-infected patients. Birth origin was not associated with clustering (adjusted odds ratio [aOR], 1.58; 95% confidence interval [CI], 0.73 to 3.43; P = 0.25, comparing Swiss-born with foreign-born patients), but clustering was reduced in HIV-infected patients (aOR, 0.49; 95% CI, 0.26 to 0.93; P = 0.030). Cavitary disease, male sex, and younger age were all associated with molecular clustering. In conclusion, most TB patients in Switzerland were foreign born, but transmission of M. tuberculosis was not more common among immigrants and was reduced in HIV-infected patients followed up in the national HIV cohort study. Continued access to health services and clinical follow-up will be essential to control TB in this population.