RR Lyrae stars are one of the primary distance indicators for old stellar populations such as globular clusters, dwarf galaxies and galaxies. Typically, fundamental-mode RR Lyr stars are used for distance measurements, and their accuracy is strongly limited by the dependence of absolute magnitudes on metallicity, in both the optical and infrared bands. Here, we report the discovery of a period–(period ratio)–metallicity relation for double-mode RR Lyr stars, which can predict metallicity as accurately as the low-resolution spectra. With theoretical and observational evidence, we propose that the period–luminosity relation of double-mode RR Lyr stars is not affected by the metallicity. Combining the Large Magellanic Cloud distance and Gaia parallaxes, we calibrate the zero point of the period–luminosity relation to an error of 0.022 mag, which means that in the best case double-mode RR Lyr stars can anchor galaxy distances to an accuracy of 1.0%. For four globular clusters and two dwarf galaxies, we obtain distances using double-mode RR Lyr stars with a distance accuracy of 2–3% and 1–2%, respectively. With future telescopes such as the China Space Station Telescope and the Vera C. Rubin Observatory, double-mode RR Lyr stars will be established as an independent distance ladder in the near-field universe.