The extragalactic background light (EBL) is the diffuse radiation with the second highest energy density in the Universe after the cosmic microwave background. The aim of this study is the measurement of the imprint of the EBL opacity to gamma-rays on the spectra of the brightest extragalactic sources detected with the High Energy Stereoscopic System (H.E.S.S.). The originality of the method lies in the joint fit of the EBL optical depth and of the intrinsic spectra of the sources, assuming intrinsic smoothness. Analysis of a total of ~10^5 gamma-ray events enables the detection of an EBL signature at the 8.8 std dev level and constitutes the first measurement of the EBL optical depth using very-high energy (E>100 GeV) gamma-rays. The EBL flux density is constrained over almost two decades of wavelengths (0.30-17 microns) and the peak value at 1.4 micron is derived as 15 +/- 2 (stat) +/- 3 (sys) nW / m^2 sr.