Changes in the electronic structures of Ge2Sb2Te5 (GST) and N-doped Ge2Sb2Te5 film during the phase transition from an amorphous to a crystalline phase were studied using synchrotron radiation high-resolution x-ray photoemission spectroscopy. The changes in tetrahedral and octahedral coordinated Ge 3d peaks are closely related to the changes in the chemical bonding state of GST films. The metallic Sb peak in the Sb 4d spectra of annealed GST films demonstrates that the metallic Sb atoms become segregated during thermal treatment resulting in phase separation. The incorporation of nitrogen into the GST film affects its structure and chemical bonding state, resulting in the suppression of crystallization. The incorporation of nitrogen also increases the optical band gap of the film due to the formation of a nitride.