Context: The bright southern Cepheid RS Pup is surrounded by a circumstellar nebula reflecting the light from the central star. The propagation of the light variations from the Cepheid inside the dusty nebula creates spectacular light echoes that can be observed up to large distances from the star itself. This phenomenon is currently unique in this class of stars. Aims: For this relatively distant star, the trigonometric parallax available from Hipparcos has a low accuracy. A careful observation of the light echoes has the potential to provide a very accurate, geometric distance to RS Pup. Methods: We obtained a series of CCD images of RS Pup with the NTT/EMMI instrument, covering the variation period of the star (P=41.4d). This allowed us to track the progression of the light wavefronts over the nebular features surrounding the star. We measured precisely the phase lag of the photometric variation in several regions of the circumstellar nebula. Results: From our phase lag measurements, we derived a geometric distance of 1992 +/- 28 pc to RS Pup. This distance is affected by a total uncertainty of 1.4%, and corresponds to a parallax of pi = 0.502 +/- 0.007 mas and a distance modulus of mu = 11.50 +/- 0.03. Conclusions: The geometric distance we derived is by far the most accurate to a Cepheid, and among the most accurate to any star. RS Pup appears both as somewhat neglected and particularly promising to investigate the mass-loss history of Cepheids. Thanks to its highly accurate distance, it is also bound to become an important luminosity fiducial for the long period part of the period-luminosity diagram.