In the diagnosis of mycobacterial infection, more than 4-8 weeks is required to identify the species of mycobacterium responsible for an infection. Therefore, the development of a method for the rapid detection and identification of mycobacteria is necessary for selecting an optimal therapeutic plan early in the patient's course. For this purpose, we developed a method combining a nested polymerase chain reaction (nested PCR) procedure and a restriction fragment length polymorphisms (RFLP) analysis of the dnaJ gene of mycobacteria, which codes for a heat shock protein. The PCR procedure allowed the sensitive detection of mycobacterial DNA in clinical samples. Using only 10 femtograms of mycobacterial DNA as a reaction mixture, a detectable band of target DNA segments could be yielded on an agarose gel. This indicates that even with a single genome amount, the PCR is able to detect mycobacteria. The RFLP analysis of the PCR products allowed us rapidly to distinguish the strains belonging to the M.tuberculosis complex from 11 different strains of nontuberculous mycobacteria. Within 2 days, the method is able to identify the mycobacterial species present in the sputum. Moreover, it has the advantage of not requiring the use of radioisotopes, which strongly enhances its clinical usefulness.