To investigate the effects of melt–rock interaction on Mg isotope fractionation and mantle Mg isotopic heterogeneity, we report high-precision Mg isotopic data of olivine (Ol), orthopyroxene (Opx), clinopyroxene (Cpx) and spinel (Spl) for 25 peridotite xenoliths from the eastern North China craton. These xenoliths range from lherzolites, Cpx-rich lherzolites to wehrlites, and are variably metasomatised. The lherzolites have Ol with Fo contents from 89 to 90 and have a homogeneous Mg isotopic composition (δ26Mg=−0.26 to −0.20), similar to the typical mantle value. By contrast, Cpx-rich lherzolites and wehrlites have lower Ol with Fo contents (78–88) and exhibit larger Mg isotopic variations, with δ26Mg ranging from −0.39 to +0.09. The δ26Mg values of minerals in these xenoliths are also variable and range from −0.45 to −0.03 in Ol, from −0.26 to −0.01 in Opx, from −0.34 to +0.22 in Cpx and from −0.16 to +0.25 in Spl. Inter-mineral fractionations between coexisting pyroxene and Ol in lherzolites and most isotopically light wehrlites (Δ26MgOpx–Ol=−0.04 to +0.09‰; Δ26MgCpx–Ol= +0.02 to +0.25‰) vary as a function of temperature and are consistent with equilibrium inter-mineral isotope fractionations. By contrast, large disequilibrium Mg isotope fractionation occurs between coexisting pyroxene and Ol in the majority of Cpx-rich lherzolites (Δ26MgOpx–Ol=+0.16 to +0.32‰; Δ26MgCpx–Ol=+0.04 to +0.34‰). Both types of isotope fractionations also occur between Spl and Ol, with Spl being consistently heavier than Ol (Δ26MgSpl–Ol=+0.15 to +0.55‰). Overall, the isotopically equilibrated but light wehrlites may result from mantle metasomatism by isotopically light melt, whereas large disequilibrium isotope fractionations in Cpx-rich peridotites likely reflect kinetic isotope fractionation during melt–peridotite interaction. Both processes result in the heterogeneous Mg isotopic composition of the lithospheric mantle beneath the eastern North China craton.