Owing to their rapid cooling rate and hence loss-limited propagation distance, cosmic-ray electrons and positrons (CRe) at very high energies probe local cosmic-ray accelerators and provide constraints on exotic production mechanisms such as annihilation of dark matter particles. We present a high-statistics measurement of the spectrum of CRe candidate events from 0.3 to 40 TeV with the High Energy Stereoscopic System, covering 2 orders of magnitude in energy and reaching a proton rejection power of better than 10^{4}. The measured spectrum is well described by a broken power law, with a break around 1 TeV, where the spectral index increases from Γ_{1}=3.25±0.02(stat)±0.2(sys) to Γ_{2}=4.49±0.04(stat)±0.2(sys). Apart from the break, the spectrum is featureless. The absence of distinct signatures at multi-TeV energies imposes constraints on the presence of nearby CRe accelerators and the local CRe propagation mechanisms.