Fear acquisition and fear extinction are the most widely used experimental models to study anxiety related disorders, with the medial prefrontal cortex (mPFC) playing an important role in this process. Previous research suggests that trait self-compassion is associated with lower anxiety, but the neural mechanisms underlying this relationship remain unclear. Women generally exhibit lower self-compassion than men, making them more vulnerable to fear and anxiety. In this study, female participants were divided into two groups - high and low trait self-compassion, based on their scores on the Self-Compassion Scale-Short Form (SCS-SF). Both groups completed fear acquisition and fear extinction tasks, during which conditioned responses (CRs) were measured using self-reported unconditioned stimulus (US) expectancy ratings, skin conductance response (SCR), and functional near-infrared spectroscopy (fNIRS). The results showed that in the fear acquisition phase, all participants successfully acquired fear, showing greater responses to threat stimuli than safety stimuli. However, participants with high trait self-compassion exhibited lower SCR than those with low trait self-compassion. In the fear extinction phase, compared to individuals with low trait self-compassion, individuals with high trait self-compassion exhibited more effective fear extinction learning, characterized by lower US expectancy ratings, lower SCR, and higher mPFC activation. Moreover, trait self-compassion was significantly correlated with the behavioral extinction ability and the mPFC activation during the late phase of fear extinction, and behavioral extinction ability was significantly correlated with mPFC activation. The findings of this study suggest individuals with high trait self-compassion have better physiological flexibility during fear acquisition and fear extinction, and may through enhancing mPFC activation to facilitate fear extinction. The results provide new insights into the pathological mechanisms of anxiety.