We report the structural evolution and the diffusion processes which occur during the phase transformation of nanoparticles (NPs), ε-Co to Co 2P to CoP, from a reaction with tri-n-octylphosphine (TOP). Extended X-ray absorption fine structure (EXAFS) investigations were used to elucidate the changes in the local structure of cobalt atoms which occur as the chemical transformation progresses. The lack of long-range order, spread in interatomic distances, and overall increase in mean-square disorder compared with bulk structure reveal the decrease in the NP's structural order compared with bulk structure, which contributes to their deviation from bulk-like behavior. Results from EXAFS show both the Co2P and CoP phases contain excess Co. Results from EXAFS, transmission electron microscopy, X-ray diffraction, and density functional theory calculations reveal that the inward diffusion of phosphorus is more favorable at the beginning of the transformation from ε-Co to Co2P by forming an amorphous Co-P shell, while retaining a crystalline cobalt core. When the major phase of the sample turns to Co 2P, the diffusion processes reverse and cobalt atom out-diffusion is favored, leaving a hollow void, characteristic of the nanoscale Kirkendall effect. For the transformation from Co2P to CoP theory predicts an outward diffusion of cobalt while the anion lattice remains intact. In real samples, however, the Co-rich nanoparticles continue Kirkendall hollowing. Knowledge about the transformation method and structural properties provides a means to tailor the synthesis and composition of the NPs to facilitate their use in applications. © 2011 The Royal Society of Chemistry.