  HD165052 is a short-period massive eccentric binary system that undergoes
apsidal motion. As the rate of apsidal motion is directly related to the
internal structure constants of the binary components, its study allows to get
insight into the internal structure of the stars. We use medium- and
high-resolution spectroscopic observations of HD165052 to provide constraints
on the fundamental properties of the binary system and the evolutionary state
of its components. We apply a spectral disentangling code to reconstruct
artefact-free spectra of the individual stars and derive the radial velocities
(RVs) at the times of the observations. We perform the first analysis of the
disentangled spectra with the non-LTE model atmosphere code CMFGEN to determine
the stellar properties. We derive the first self-consistent orbital solution of
all existing RV data, including those reported in the literature, accounting
for apsidal motion. We build, for the very first time, dedicated stellar
evolution tracks with the Cl\'es code requesting the theoretical effective
temperatures and luminosities to match those obtained from our spectroscopic
analysis. The binary system HD165052, consisting of an O6.5V((f)) primary and
an O7V((f)) secondary, displays apsidal motion at a rate of
(11.30+0.64-0.49)$\deg$yr$^{-1}$. Evolutionary masses are compared to minimum
dynamical masses to constrain the orbital inclination. Evolutionary masses
Mev,P=24.8$\pm$1.0M$_\odot$ and Mev,S=20.9$\pm$1.0M$_\odot$ and radii
Rev,P=7.0+0.5-0.4R$_\odot$ and Rev,S=6.2+0.4-0.3R$_\odot$ are derived, and the
inclination is constrained to 22.1$\deg\le i\le 23.3\deg$. Theoretical apsidal
motion rates, derived assuming an age of 2.0+/-0.5 Myr for the binary, are in
agreement with the observational determination. The agreement with theoretical
apsidal motion rates enforces the inferred values of the evolutionary stellar
masses and radii.
