Previous research suggests a role of the dorsomedial prefrontal cortex (dmPFC) in metacognitive representation of social information, while the right posterior superior temporal sulcus (pSTS) has been linked to social perception. This study targeted these functional roles in the context of spontaneous mentalizing. An animated shapes task was presented to 46 subjects during functional magnetic resonance imaging. Stimuli consisted of video clips depicting animated shapes whose movement patterns prompt spontaneous mentalizing or simple intention attribution. Based on their differential response during spontaneous mentalizing, both regions were characterized with respect to their task-dependent connectivity profiles and their associations with autistic traits. Functional network analyses revealed highly localized coupling of the right pSTS with visual areas in the lateral occipital cortex, while the dmPFC showed extensive coupling with instances of large-scale control networks and temporal areas including the right pSTS. Autistic traits were related to mentalizing-specific activation of the dmPFC and to the strength of connectivity between the dmPFC and posterior temporal regions. These results are in good agreement with the hypothesized roles of the dmPFC and right pSTS for metacognitive representation and perception-based processing of social information, respectively, and further inform their implication in social behavior linked to autism. Hum Brain Mapp, 2017. © 2017 Wiley Periodicals, Inc.