A pyridine-catalyzed ylide cyclization affording dihydrofurans and dihydropyrroles has been developed. In the presence of a catalytic amount of pyridine and Fe(Tcpp)Cl, α-ylidene-β-diketones and α,β-unsaturated imines react with diazoacetates providing dihydrofurans and dihydropyrroles respectively, in up to 96% yield with high diastereoselectivities.