Gauge theories are fundamental to our understanding of interactions between the elementary constituents of matter as mediated by gauge bosons1,2. However, computing the real-time dynamics in gauge theories is a notorious challenge for classical computational methods. This has recently stimulated theoretical effort, using Feynman’s idea of a quantum simulator3,4, to devise schemes for simulating such theories on engineered quantum-mechanical devices, with the difficulty that gauge invariance and the associated local conservation laws (Gauss laws) need to be implemented5,6,7. Here we report the experimental demonstration of a digital quantum simulation of a lattice gauge theory, by realizing (1 + 1)-dimensional quantum electrodynamics (the Schwinger model8,9) on a few-qubit trapped-ion quantum computer. We are interested in the real-time evolution of the Schwinger mechanism10,11, describing the instability of the bare vacuum due to quantum fluctuations, which manifests itself in the spontaneous creation of electron–positron pairs. To make efficient use of our quantum resources, we map the original problem to a spin model by eliminating the gauge fields12in favour of exotic long-range interactions, which can be directly and efficiently implemented on an ion trap architecture13. We explore the Schwinger mechanism of particle–antiparticle generation by monitoring the mass production and the vacuum persistence amplitude. Moreover, we track the real-time evolution of entanglement in the system, which illustrates how particle creation and entanglement generation are directly related. Our work represents a first step towards quantum simulation of high-energy theories using atomic physics experiments—the long-term intention is to extend this approach to real-time quantum simulations of non-Abelian lattice gauge theories.