A widely applicable technique is described by which atomic hyperfine-structure splittings and optical isotope shifts may be measured to high accuracies by determining the heterodyne beat frequency between two tunable dye lasers locked to different hyperfine-structure or isotope-shifted transitions of atoms in an atomic beam. A measurement of the hyperfine splitting of the 3P1/2 level in the 589.6 nm line of sodium has been performed, producing a value of 188.93 (+or-0.02) MHz. The quoted accuracy represents +or-4 parts in 1011 of the optical transition frequency.