Bafilomycin B1 is the archetypal compound of the plecomacrolide family of natural products with diverse bioactivities but limited clinical application due to general toxicity. To generate novel analogues via genetic manipulation, the bafilomycin biosynthetic gene cluster from Streptomyces lohii was elucidated. A fosmid library was constructed from S. lohii genomic DNA and probed for type I polyketide ketosynthase (KS) domains using a radiolabeled PCR product amplified by degenerate primers, yielding 12 KS-positive fosmids. Sequencing analysis showed the cluster includes five type I polyketide synthase (PKS) genes (bafAI–bafAV) for assembling the macrolactone core (following colinearity rules), a PKS type II thioesterase gene (bafH), genes for 5-aminolevulinic acid (5-ALA) biosynthesis (bafZ) and C5N moiety formation (bafX, bafY), and genes for methoxymalonate biosynthesis (bafB–F). Targeted disruption of bafAIII via the REDIRECT system resulted in loss of bafilomycin production, validating the cluster's function. In vitro experiments confirmed BafZ catalyzes 5-ALA formation from glycine and succinyl-CoA, supporting the proposed C5N biosynthesis pathway (BafZ→BafX→BafZ→BafY). This study provides the genetic basis for engineering bafilomycin structures to improve target specificity and reduce toxicity.