Massive binary systems are important laboratories in which to probe the properties of massive stars and stellar physics in general . In this context , we analysed optical spectroscopy and photometry of the eccentric short-period early-type binary HD 152218 in the young open cluster NGC 6231 . We reconstructed the spectra of the individual stars using a separating code . The individual spectra were then compared with synthetic spectra obtained with the CMFGEN model atmosphere code . We furthermore analysed the light curve of the binary and used it to constrain the orbital inclination and to derive absolute masses of ( 19.8 \pm 1.5 ) and ( 15.0 \pm 1.1 ) M _ { \odot } . Combining radial velocity measurements from over 60 years , we show that the system displays apsidal motion at a rate of ( 2.04 ^ { + .23 } _ { - .24 } ) ^ { \circ } yr ^ { -1 } . Solving the Clairaut-Radau equation , we used stellar evolution models , obtained with the CLES code , to compute the internal structure constants and to evaluate the theoretically predicted rate of apsidal motion as a function of stellar age and primary mass . In this way , we determine an age of 5.8 \pm 0.6 Myr for HD 152218 , which is towards the higher end of , but compatible with , the range of ages of the massive star population of NGC 6231 as determined from isochrone fitting .