Natural Diels–Alderases that selectively form endo or exo products are increasingly well known but generally form one stereoisomer with limited substrate scope. Here we report the discovery of two homologous groups of flavin-adenine-dinucleotide-dependent enzymes that catalyse intermolecular Diels–Alder reactions on the same substrates with opposite endo/exo selectivity and high enantioselectivity. We show that these enzymes are effective biocatalysts with a wide range of diene and dienophile substrates. The crystal structure of an exo-selective Diels–Alderase was determined at 2.94 Å resolution. Based on the structure and computational investigation of the catalytic mechanism, we designed and prepared mutant enzymes that reverse the stereoselectivity from exo to endo. A combination of structure-based comparison, computational and mutational studies have revealed two different catalytic mechanisms that control the endo/exo selectivity in these enzymatic Diels–Alder reactions.