Mental strength and history of winning play an important role in the determination of social dominance. However, the neural circuits mediating these intrinsic and extrinsic factors have remained unclear. Working in mice, we identified a dorsomedial prefrontal cortex (dmPFC) neural population showing “effort”-related firing during moment-to-moment competition in the dominance tube test. Activation or inhibition of the dmPFC induces instant winning or losing, respectively. In vivo optogenetic-based long-term potentiation and depression experiments establish that the mediodorsal thalamic input to the dmPFC mediates long-lasting changes in the social dominance status that are affected by history of winning. The same neural circuit also underlies transfer of dominance between different social contests. These results provide a framework for understanding the circuit basis of adaptive and pathological social behaviors.