Prequeuosine (preQ1) riboswitches are RNA regulatory elements located in the 5' UTR of genes involved in the biosynthesis and transport of preQ1, a precursor of the modified base queuosine universally found in four tRNAs. The preQ1 class II (preQ1-II) riboswitch regulates preQ1 biosynthesis at the translational level. We present the solution NMR structure and conformational dynamics of the 59 nucleotide Streptococcus pneumoniae preQ1-II riboswitch bound to preQ1. Unlike in the preQ1 class I (preQ1-I) riboswitch, divalent cations are required for high-affinity binding. The solution structure is an unusual H-type pseudoknot featuring a P4 hairpin embedded in loop 3, which forms a three-way junction with the other two stems. (13)C relaxation and residual dipolar coupling experiments revealed interhelical flexibility of P4. We found that the P4 helix and flanking adenine residues play crucial and unexpected roles in controlling pseudoknot formation and, in turn, sequestering the Shine-Dalgarno sequence. Aided by divalent cations, P4 is poised to act as a "screw cap" on preQ1 recognition to block ligand exit and stabilize the binding pocket. Comparison of preQ1-I and preQ1-II riboswitch structures reveals that whereas both form H-type pseudoknots and recognize preQ1 using one A, C, or U nucleotide from each of three loops, these nucleotides interact with preQ1 differently, with preQ1 inserting into different grooves. Our studies show that the preQ1-II riboswitch uses an unusual mechanism to harness exquisite control over queuosine metabolism.