Many-body Green's functions encode all the properties and excitations of interacting electrons. While these are challenging to be evaluated accurately on a classical computer, recent efforts have been directed toward finding quantum algorithms that may provide a quantum advantage for this task, exploiting architectures that will become available in the near future. In this work we introduce a novel near-term quantum algorithm for computing one-particle Green's functions via their Lehmann representation. The method is based on a generalization of the quantum equation of motion algorithm that gives access to the charged excitations of the system. We demonstrate the validity of the present proposal by computing the Green's function of a two-site Fermi-Hubbard model on a IBM quantum processor.