Ni doped, Li doped and (Li, Ni) codoped ZnO thin films were successfully grown using a pulsed laser deposition technique. Undoped and doped ZnO thin films were investigated using extended x-ray absorption fine structure (EXAFS) and x-ray absorption near edge spectroscopy (XANES). Preliminary investigations on the Zn K-edge of the undoped and doped ZnO thin films revealed that doping has not influenced the average Zn-Zn bond length and Debye-Waller factor. This shows that both Ni and Li doping do not appreciably affect the average local environment of Zn. All the doped ZnO thin films exhibited more than 50% of substitutional Ni, with a maximum of 77% for 2% Ni and 2% Li doped ZnO thin film. The contribution of Ni metal to the EXAFS signal clearly reveals the presence of Ni clusters. The Ni-Ni distance in the Ni0 nanoclusters, which are formed in the film, is shorter with respect to the reference Ni metal foil and the Debye-Waller factor is higher. Both facts perfectly reflect what is expected for metal nanoparticles. At the highest doping concentration (5%), the presence of Li favors the growth of a secondary NiO phase. Indeed, 2% Ni and 5% Li doped ZnO thin film shows %Ni sub = 75 ± 11, %Ni met = 10 ± 8, %NiO = 15 ± 8. XANES studies further confirm that the substitutional Ni is more than 50% in all the samples. These results explain the observed magnetic properties. © 2013 IOP Publishing Ltd.