Recent studies have indicated strong connections between epigenetic modulation and secondary metabolites in plants. It is vital to understand the roles of epigenetics in the production of secondary metabolites. In this study, the inhibitor of DNA methylation 5-azacytidine (5-Az) was used on the hairy roots of the medicinal plant Salvia miltiorrhiza to investigate its effect on secondary metabolite production, gene expression, methylation levels in genomic DNA and promoter regions. Our results showed that the contents of tanshinones in S. miltiorrhiza hairy roots increased by 1.5–5 times, and some genes in the biosynthesis pathway showed an upward trend. According to our NGS analysis, the methylation pattern in the promotor of the gene encoding copalyl diphosphate synthase (CPS) was altered, and 51 out of 145 cytosines were demethylated during 5-Az treatment. A total of 36 putative transcription factors (TFs) binding cites were identified in these demethylation sites. Among these TFs binding cites, cis-regulatory elements for the binding of NF-Y and MYB were frequently found in our results. This is the first report to demonstrate a possible mechanism of DNA methylation participating in tanshinone biosynthesis in S. miltiorrhiza hairy roots by modulating the CPS promoter and TFs binding sites.