In recent years, many γ-ray sources have been identified, yet the unresolved component hosts valuable information on the faintest emission. In order to extract it, a cross-correlation with gravitational tracers of matter in the Universe has been shown to be a promising tool. We report here the first identification of a cross-correlation signal between γ rays and the distribution of mass in the Universe probed by weak gravitational lensing. We use data from the Dark Energy Survey Y1 weak lensing data and the Fermi Large Area Telescope 9-yr γ-ray data, obtaining a signal-to-noise ratio of 5.3. The signal is mostly localized at small angular scales and high γ-ray energies, with a hint of correlation at extended separation. Blazar emission is likely the origin of the small-scale effect. We investigate implications of the large-scale component in terms of astrophysical sources and particle dark matter emission.