One of the exciting movements in microbial sciences has been a refocusing and revitalization of efforts to mine the fungal secondary metabolome. The magnitude of biosynthetic gene clusters (BGCs) in a single filamentous fungal genome combined with the historic number of sequenced genomes suggests that the secondary metabolite wealth of filamentous fungi is largely untapped. Mining algorithms and scalable expression platforms have greatly expanded access to the chemical repertoire of fungal-derived secondary metabolites. In this Review, I discuss new insights into the transcriptional and epigenetic regulation of BGCs and the ecological roles of fungal secondary metabolites in warfare, defence and development. I also explore avenues for the identification of new fungal metabolites and the challenges in harvesting fungal-derived secondary metabolites. Fungi have a long and intimate connection with humankind, particularly at the chemical level. The realization that fungi were the source of both harmful and beneficial compounds was brought to light by the aflatoxin poisoning event Turkey X disease in the 1960s 1 and the discovery of the first broad-spectrum antibiotic, penicillin, considered the 'wonder drug' of World War II 2. These bioactive molecules, termed secondary metabolites (also known as natural products), are produced by specific fungal taxa, predominately by filamentous fungi that belong to the Pezizomycotina Ascomycete class, and several Basidiomycete classes (for example, Agaricomycetes and Exobasidiomycetes), as well as by unexpected taxa such as Kluyveromyces lactis, in which the pulcherrimin gene cluster was recently discovered 3. Secondary metabolites are derived from central metabolic pathways and primary metabolite pools, with acyl-CoAs being the critical initial building blocks that feed into the synthesis of polyketide (for example, aflatoxin) and terpene (for example, carotene) secondary metabolites and amino acids being used for the synthesis of non-ribosomal peptide secondary metabolites (for example, penicillin) (FIG. 1a). In contrast to genes that are required for the synthesis of a primary metabolite that are dispersed throughout the fungal Competing interests There is no competing interest. Publisher's note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Reviewer information Nature Reviews Microbiology thanks M. Andersen, J. Cary, D. Hoffmeister and the other anonymous reviewer(s) for their contribution to the peer review of this work.