The age of dense interstellar cloud cores, where stars and planets form, is a crucial parameter in star formation and difficult to measure. Some models predict rapid collapse, whereas others predict timescales of more than one million years (ref. 3). One possible approach to determining the age is through chemical changes as cloud contraction occurs, in particular through indirect measurements of the ratio of the two spin isomers (ortho/para) of molecular hydrogen, H2, which decreases monotonically with age. This has been done for the dense cloud core L183, for which the deuterium fractionation of diazenylium (N2H+) was used as a chemical clock to infer that the core has contracted rapidly (on a timescale of less than 700,000 years). Among astronomically observable molecules, the spin isomers of the deuterated trihydrogen cation, ortho-H2D+ and para-H2D+, have the most direct chemical connections to H2 (refs 8, 9, 10, 11, 12) and their abundance ratio provides a chemical clock that is sensitive to greater cloud core ages. So far this ratio has not been determined because para-H2D+ is very difficult to observe. The detection of its rotational ground-state line has only now become possible thanks to accurate measurements of its transition frequency in the laboratory, and recent progress in instrumentation technology. Here we report observations of ortho- and para-H2D+ emission and absorption, respectively, from the dense cloud core hosting IRAS 16293-2422 A/B, a group of nascent solar-type stars (with ages of less than 100,000 years). Using the ortho/para ratio in conjunction with chemical models, we find that the dense core has been chemically processed for at least one million years. The apparent discrepancy with the earlier N2H+ work arises because that chemical clock turns off sooner than the H2D+ clock, but both results imply that star-forming dense cores have ages of about one million years, rather than 100,000 years.