Fungal bicyclo[2.2.2]diazaoctane indole alkaloids represent an important family of natural products with a wide-spectrum of biological activities. Although biomimetic total syntheses of representative compounds have been reported, the details of their biogenesis, especially the mechanisms for assembly of diastereomerically distinct and enantiomerically antipodal metabolites, have remained largely uncharacterized. Brevianamide A represents a basic form of the sub-family bearing a dioxopiperazine core and a rare 3-spiro-ψ-indoxyl skeleton. Here, we identified the Brevianamide A biosynthetic gene cluster from Penicillium brevicompactum NRRL 864 and elucidated the metabolic pathway. BvnE was revealed to be an essential isomerase/semi-pinacolase that specifies selective production of the natural product. Structural elucidation, molecular modeling, and mutational analysis of BvnE, and quantum chemical calculations provided mechanistic insights into the diastereoselective formation of the 3-spiro-ψ-indoxyl moiety in Brevianamide A. This occurs through a BvnE-controlled semi-pinacol rearrangement and a subsequent spontaneous intramolecular [4+2] hetero-Diels-Alder cycloaddition.