Context. Magnetic neutron stars (NSs) often exhibit a cyclotron resonant scattering feature (CRSF) in their X-ray spectra. Cyclotron lines are believed to be generated in the radiative shock in the accretion column. High-luminosity NSs show a smooth anti-correlation between the cyclotron-line centroid (ECRSF) and X-ray luminosity (LX). Aims. It has been pointed out that the observed ECRSF − LX smooth anti-correlation in high-luminosity NSs is in tension with the theoretically predicted one, if the radiative shock is the site of cyclotron-line formation. The shock height increases approximately linearly with luminosity, while the dipolar magnetic field drops as the cubic power of distance, thereby implying that the cyclotron-line energy ought to decrease significantly when the luminosity increases by, say, an order of magnitude, which is contrary to observations. Since there is no other candidate site for the cyclotron-line formation, we re-examine the predicted rate of change of the cyclotron-line energy with luminosity at the radiative shock, taking a closer look at the Physics involved. Methods. We developed a purely analytical model describing the overall dependence of the observed cyclotron energy centroid on the shock front’s height, including both the relativistic boosting and the gravitational redshift effects in our considerations. The relativistic boosting effect is due to the mildly relativistic motion of the accreting plasma upstream with respect to the shock’s reference frame. Reults. We find that the cyclotron-line energy varies with (a) the shock height due to the dipolar magnetic field, (b) the Doppler boosting between the shock and bulk-motion frames, and (c) the gravitational redshift. We show that the relativistic effects noticeably weaken the predicted ECRSF − LX anti-correlation. We use our model to fit the data of the X-ray source V0332+53 that exhibits a weak negative correlation and demonstrate that the model fits the data impressively well, thereby alleviating the tension between observations and theory. Conclusions. The reported weak anti-correlation between cyclotron-line centroid and X-ray luminosity in the supercritical accretion regime may be explained by the combination of the variation of the magnetic-field strength along the accretion column, the effect of Doppler boosting, and the gravitational redshift. As a result of these effects, the actual magnetic field on the surface of the neutron star may be a factor of ∼2 larger than the naively inferred value from the observed CRSF.