Residual stresses in sputtered ZnO films on Si are investigated and discussed. By means of X-ray diffraction, we show that as-deposited ZnO films encapsulated or not by Si3N4 protective coatings are highly compressively stressed. Moreover, a transition of stress is observed as a function of the post-deposition annealing temperature. After a heat treatment at 800°C, ZnO films are tensily stressed while ZnO films encapsulated by Si3N4 are stress-free. With the aid of in-situ X-ray diffraction, we argue that this thermally-activated stress relaxation can be attributed to a variation of the chemical composition of the ZnO films.