Aims. Even the most-precise radial-velocity instruments gather high-resolution spectra that present systematic errors that a data reduction pipeline cannot identify and correct for efficiently by analysing a set of calibrations and a single science frame. In this paper, we aim at improving the radial-velocity precision of HARPS measurements by 'cleaning' individual extracted spectra using the wealth of information contained in spectra time-series. Methods. We developed YARARA, a post-processing pipeline designed to clean high-resolution spectra from instrumental systematics and atmospheric contamination. Spectra are corrected for: tellurics, interference pattern, detector stitching, ghosts and fiber B contaminations as well as more advanced spectral line-by-line corrections. YARARA uses Principal Component Analysis on spectra time-series with prior information to disentangle contaminations from real Doppler shifts. We applied YARARA on three systems: HD10700, HD215152 and HD10180 and compared our results to the HARPS standard Data Reduction Software and the SERVAL post-processing pipeline.Results. We run YARARA on the radial-velocity data set of three stars intensively observed with HARPS: HD10700, HD215152 and HD10180. On HD10700, we show that YARARA enables to obtain radial-velocity measurements that present a rms smaller than 1 m s −1 over the 13 years of the HARPS observations, which is 20 and 10 % better than the HARPS Data Reduction Software and the SERVAL post-processing pipeline, respectively. We also injected simulated planets on the data of HD10700 and demonstrated that YARARA does not alter pure Doppler shifted signals. On HD215152, we demonstrated that the 1-year signal visible in the periodogram becomes marginal after processing with YARARA and that the signals of the known planets become more significant. Finally, on HD10180, the known six exoplanets are well recovered although different orbitals parameters and planetary masses are provided by the new reduced spectra. Conclusions. Post-processing correction of spectra using spectra time-series allows to significantly improve the radial-velocity precision of HARPS data and demonstrate that for the extremely quiet star HD10700, a radial-velocity root mean square better than 1 m/s can be reached over the 13 years of HARPS observations. Since the processing proposed in this paper does not absorb planetary signals, its application to system intensively followed is promising and will certainly push further the detection of the lightest exoplanets.