An ongoing challenge in chemical research is to design catalysts that select the outcomes of the reactions of complex molecules. Chemists rely on organocatalysts or transition metal catalysts to control stereoselectivity, regioselectivity and periselectivity (selectivity among possible pericyclic reactions). Nature achieves these types of selectivity with a variety of enzymes such as the recently discovered pericyclases-a family of enzymes that catalyse pericyclic reactions1. Most characterized enzymatic pericyclic reactions have been cycloadditions, and it has been difficult to rationalize how the observed selectivities are achieved2-13. Here we report the discovery of two homologous groups of pericyclases that catalyse distinct reactions: one group catalyses an Alder-ene reaction that was, to our knowledge, previously unknown in biology; the second catalyses a stereoselective hetero-Diels-Alder reaction. Guided by computational studies, we have rationalized the observed differences in reactivities and designed mutant enzymes that reverse periselectivities from Alder-ene to hetero-Diels-Alder and vice versa. A combination of in vitro biochemical characterizations, computational studies, enzyme co-crystal structures, and mutational studies illustrate how high regioselectivity and periselectivity are achieved in nearly identical active sites.