Barnard’s star is a red dwarf, and has the largest proper motion (apparent motion across the sky) of all known stars. At a distance of 1.8 parsecs, it is the closest single star to the Sun; only the three stars in the α Centauri system are closer. Barnard’s star is also among the least magnetically active red dwarfs known and has an estimated age older than the Solar System. Its properties make it a prime target for planetary searches; various techniques with different sensitivity limits have been used previously, including radial-velocity imaging, astrometry and direct imaging, but all ultimately led to negative or null results. Here we combine numerous measurements from high-precision radial-velocity instruments, revealing the presence of a low-amplitude periodic signal with a period of 233 days. Independent photometric and spectroscopic monitoring, as well as an analysis of instrumental systematic effects, suggest that this signal is best explained as arising from a planetary companion. The candidate planet around Barnard’s star is a cold super-Earth, with a minimum mass of 3.2 times that of Earth, orbiting near its snow line (the minimum distance from the star at which volatile compounds could condense). The combination of all radial-velocity datasets spanning 20 years of measurements additionally reveals a long-term modulation that could arise from a stellar magnetic-activity cycle or from a more distant planetary object. Because of its proximity to the Sun, the candidate planet has a maximum angular separation of 220 milliarcseconds from Barnard’s star, making it an excellent target for direct imaging and astrometric observations in the future.