A key observational prediction of Einstein's Equivalence Principle is that light undergoes redshift when it escapes from a gravitational field. Although astrophysics provides a wide variety of physical conditions in which this redshift should be significant, until very recently the observational evidence for this gravitational effect was limited to the light emitted by the Sun and white dwarfs. Gaia-DR2 astrometric and kinematic data, in combination with other spectroscopic observations, provides a test bench to validate such predictions in statistical terms. The aim of this paper is to analyze several thousand main-sequence and giant stars in open clusters (OCs) in order to measure the gravitational redshift effect. Observationally, a spectral shift will depend on the stellar mass-to-radius ratio as expected from the theoretical estimation of relativity. After the analysis, the obtained correlation coefficient between theoretical predictions and observations for 28 (51) OCs is a = 0.977 ± 0.218 (0.899 ± 0.137). The result has proven to be statistically robust and with little dependence on the details of the methodology or sample selection criteria. This study represents one of the more extensive validations of a fundamental prediction of gravity theories.