Most people are generous, but not toward everyone alike: generosity usually declines with social distance between individuals, a phenomenon called social discounting. Despite the pervasiveness of social discounting, social distance between actors has been surprisingly neglected in economic theory and neuroscientific research. We used functional magnetic resonance imaging (fMRI) to study the neural basis of this process to understand the neural underpinnings of social decision making. Participants chose between selfish and generous alternatives, yielding either a large reward for the participant alone, or smaller rewards for the participant and another individual at a particular social distance. We found that generous choices engaged the temporoparietal junction (TPJ). In particular, the TPJ activity was scaled to the social-distance-dependent conflict between selfish and generous motives during prosocial choice, consistent with ideas that the TPJ promotes generosity by facilitating overcoming egoism bias. Based on functional coupling data, we propose and provide evidence for a biologically plausible neural model according to which the TPJ supports social discounting by modulating basic neural value signals in the ventromedial prefrontal cortex to incorporate social-distance-dependent other-regarding preferences into an otherwise exclusively own-reward value representation.