In the fundamental laws of physics, gauge fields mediate the interaction between charged particles. An example is the quantum theory of electrons interacting with the electromagnetic field, based on U(1) gauge symmetry. Solving such gauge theories is in general a hard problem for classical computational techniques. Although quantum computers suggest a way forward, large-scale digital quantum devices for complex simulations are difficult to build. We propose a scalable analog quantum simulator of a U(1) gauge theory in one spatial dimension. Using interspecies spin-changing collisions in an atomic mixture, we achieve gauge-invariant interactions between matter and gauge fields with spin- and species-independent trapping potentials. We experimentally realize the elementary building block as a key step toward a platform for quantum simulations of continuous gauge theories.