Divalent metal ions, such as Mg(2+), are generally required for tertiary structure formation in RNA. Although the role of Mg(2+) binding in RNA-folding equilibria has been studied extensively, little is known about the role of Mg(2+) in RNA-folding kinetics. In this paper, we explore the effect of Mg(2+) on the rate-limiting step in the kinetic folding pathway of the Tetrahymena ribozyme. Analysis of these data reveals the presence of a Mg(2+)-stabilized kinetic trap that slows folding at higher Mg(2+) concentrations. Thus, the Tetrahymena ribozyme folds with an optimal rate at 2 mM Mg(2+), just above the concentration required for stable structure formation. These results suggest that thermodynamic and kinetic folding of RNA are cooptimized at a Mg(2+) concentration that is sufficient to stabilize the folded form but low enough to avoid kinetic traps and misfolding.