Gene translation depends on accurate decoding of mRNA, the structural mechanism of which remains poorly understood. Ribosomes decode mRNA codons by selecting cognate aminoacyl-tRNAs delivered by elongation factor Tu (EF-Tu). Here we present high-resolution structural ensembles of ribosomes with cognate or near-cognate aminoacyl-tRNAs delivered by EF-Tu. Both cognate and near-cognate tRNA anticodons explore the aminoacyl-tRNA-binding site (A site) of an open 30S subunit, while inactive EF-Tu is separated from the 50S subunit. A transient conformation of decoding-centre nucleotide G530 stabilizes the cognate codon-anticodon helix, initiating step-wise 'latching' of the decoding centre. The resulting closure of the 30S subunit docks EF-Tu at the sarcin-ricin loop of the 50S subunit, activating EF-Tu for GTP hydrolysis and enabling accommodation of the aminoacyl-tRNA. By contrast, near-cognate complexes fail to induce the G530 latch, thus favouring open 30S pre-accommodation intermediates with inactive EF-Tu. This work reveals long-sought structural differences between the pre-accommodation of cognate and near-cognate tRNAs that elucidate the mechanism of accurate decoding.