All known human societies have maintained social order by enforcing compliance with social norms. The biological mechanisms underlying norm compliance are, however, hardly understood. We show that the right lateral prefrontal cortex (rLPFC) is involved in both voluntary and sanction-induced norm compliance. Both types of compliance could be changed by varying the neural excitability of this brain region with transcranial direct current stimulation, but they were affected in opposite ways, suggesting that the stimulated region plays a fundamentally different role in voluntary and sanction-based compliance. Brain stimulation had a particularly strong effect on compliance in the context of socially constituted sanctions, whereas it left beliefs about what the norm prescribes and about subjectively expected sanctions unaffected. Our findings suggest that rLPFC activity is a key biological prerequisite for an evolutionarily and socially important aspect of human behavior.