Molecular-scale components are expected to be central to the realization of nanoscale electronic devices1,2,3. Although molecular-scale switching has been reported in atomic quantum point contacts4,5,6, single-molecule junctions provide the additional flexibility of tuning the on/off conductance states through molecular design. To date, switching in single-molecule junctions has been attributed to changes in the conformation or charge state of the molecule7,8,9,10,11,12. Here, we demonstrate reversible binary switching in a single-molecule junction by mechanical control of the metal–molecule contact geometry. We show that 4,4'-bipyridine–gold single-molecule junctions can be reversibly switched between two conductance states through repeated junction elongation and compression. Using first-principles calculations, we attribute the different measured conductance states to distinct contact geometries at the flexible but stable nitrogen–gold bond: conductance is low when the N–Au bond is perpendicular to the conducting π-system, and high otherwise. This switching mechanism, inherent to the pyridine–gold link, could form the basis of a new class of mechanically activated single-molecule switches. Molecular-scale switches will be central components in nanoscale electronic devices. Switching in single-molecule junctions has so far been achieved through changes in the conformation or charge state of the molecule. Now, reversible binary switching has been demonstrated by mechanical control of the metal–molecule contact geometry—a mechanism which could form the basis for a new class of mechanically activated single-molecule switches.