The PCR-based variable-number tandem repeats (VNTR) typing method is a very promising tool for the molecular epidemiological study of Mycobacterium tuberculosis. The discriminatory power of the VNTR loci that were optimized in many previous studies has not been evaluated in Shanghai, an area where Beijing genotype strains dominate. In the present study, we first performed a literature search to identify VNTR loci that were at least 45 bp in length. Second, we determined the Hunter-Gaston discriminatory index (HGI) values of each of the 45 VNTR loci that we identified, using Beijing genotype strains from a 'test set' of isolates from a population with low migration in Chongming Island, Shanghai, China. Third, we optimized two sets of VNTR loci, which we named VNTR-7 and VNTR-16. The HGI value of VNTR-7 was slightly lower than that of IS6110 restriction fragment length polymorphisms (RFLP), and the HGI values of VNTR-16 and IS6110 RFLP were comparable. Our results suggest that VNTR-7, followed by VNTR-16 and IS6110 RFLP, can be used routinely as a tool to discriminate between M. tuberculosis isolates in population-based epidemiologic studies of M. tuberculosis transmission in Shanghai, China.