Two magnetic atoms, one attached to the tip of a scanning tunnelling microscope and one adsorbed on a metal surface, each constituting a Kondo system, have been proposed as one of the simplest conceivable systems potentially exhibiting quantum critical behaviour. We have succeeded in implementing this concept experimentally for cobalt dimers clamped between a scanning tunnelling microscope tip and a gold surface. Control of the tip-sample distance with subpicometre resolution enables us to tune the interaction between the two cobalt atoms with unprecedented precision. Electronic transport measurements on this two-impurity Kondo system reveal a rich physical scenario, which is governed by a crossover from local Kondo screening to non-local singlet formation due to antiferromagnetic coupling as a function of separation of the cobalt atoms.