Riboflavin is an essential cofactor in all organisms. Its direct biosynthetic precursor, 6,7-dimethyl-8-ribityllumazine, is synthesised by the enzyme 6,7-dimethyl-8-ribityllumazine synthase. Recently, we have found that the enzyme from Schizosaccharomyces pombe binds riboflavin, the final product of the pathway with a relatively high affinity with a KD of 1.2 microM. Here, we report on the crystal structure of lumazine synthase from S. pombe with bound riboflavin and compare the binding mode with those of the substrate analogue inhibitor 5-nitro-6-(D-ribitylamino)-2,4(1H,3H)-pyrimidinedione and of the product analogue 6-carboxyethyl-7-oxo-8-ribityllumazine. In all complexes the pyrimidinedione moieties of each respective ligand bind in a very similar orientation. Binding of riboflavin additionally involves a stacking interaction of the dimethylbenzene moiety with the side-chain of His94, a highly conserved residue in all lumazine synthases. The enzyme from Bacillus subtilis showed a KD of at least 1 mM whereas the very homologous enzyme from Saccharomyces cerevisiae had a comparable KD of 3.9 microM. Structural comparison of the S. cerevisiae, the S. pombe, and the mutant enzymes suggests that fine tuning of affinity is achieved by influencing this stacking interaction.