Action observation leads to the automatic activation of the corresponding motor representation in the observer through "mirror-matching." This constitutes a "shared representational system," which is thought to subserve social understanding by motor simulation. However, it is unclear how these shared representations can be controlled and distinguished. Brain imaging suggests that controlling shared representations, indexed by the ability to control automatic imitative responses, activates anterior fronto-median cortex (aFMC), and temporo-parietal junction (TPJ). Crucially, these regions are also consistently implicated in mental state attribution and have provided an alternative account for higher-level social cognition. Here, we directly tested whether social-cognitive processes involve similar key computational mechanisms as the control of shared representations by using functional brain imaging to reveal overlapping brain circuits. We show in a within-subject design that commonly activated regions occurred selectively in aFMC and TPJ. Mentalizing and self-referential thoughts recruited a region in aFMC, which was also activated when controlling imitation. In the TPJ, an area overlapped between mentalizing, agency processing, and imitative control. Behavioral and neural correlates of mentalizing were further related to the individual ability for controlling imitation. Our findings support the assumption of shared key processes and suggest a novel link between embodied and social cognition.