Gamma-ray line signatures can be expected in the very-high-energy (VHE; E_\gamma > 100 GeV) domain due to self-annihilation or decay of dark matter (DM) particles in space. Such a signal would be readily distinguishable from astrophysical \gamma-ray sources that in most cases produce continuous spectra which span over several orders of magnitude in energy. Using data collected with the H.E.S.S. \gamma-ray instrument, upper limits on line-like emission are obtained in the energy range between ~500 GeV and ~25 TeV for the central part of the Milky Way halo and for extragalactic observations, complementing recent limits obtained with the Fermi-LAT instrument at lower energies. No statistically significant signal could be found. For monochromatic \gamma-ray line emission, flux limits of (2x10^-7 - 2x10^-5) m^-2 s^-1 sr^-1 and (1x10^-8 - 2x10^-6) m^-2 s^-1 sr^-1 are obtained for the central part of the Milky Way halo and extragalactic observations, respectively. For a DM particle mass of 1 TeV, limits on the velocity-averaged DM annihilation cross section < \sigma v >(\chi\chi -> \gamma\gamma) reach ~10^-27 cm^3 s^-1, based on the Einasto parametrization of the Galactic DM halo density profile.