Understanding the heteroatoms occupancy in metal phosphides is significant to regulate their properties. (FexNi1-x)2P (0 ≤ x ≤ 0.5) nanocrystals were prepared by thermal decomposition. Effects of Fe substitution on structure, morphology and magnetic properties were studied. As the Fe content increases, (FexNi1-x)2P maintain hexagonal structure with morphologies changing from sphere to irregular sheet. Atomic HAADF-STEM image reveals that the atom configuration matches well with [001] crystallographic orientation. (FexNi1-x)2P nanocrystals show room-temperature ferromagnetism. The Ms values and magnetocrystalline anisotropy are enhanced by increasing Fe substitution. The Ms value of (Fe0·5Ni0.5)2P reaches 2.092 emu/g, 19.5 times larger than Ni2P. XPS and Mössbauer spectra show that Fe2+/Fe3+ selectively occupy tetrahedral and pyramidal positions due to the difference of ionic radius, resulting in enhanced room-temperature ferromagnetism. First-principles calculations show that Fe substitution can induce ferromagnetic ordering in Ni2P, and Fe substitution in pyramidal positions induces larger magnetic moment, further confirming the experimental results.