Variations of residual stresses in layers on substrates can occur in directions parallel and perpendicular to the surface as a result of compositional inhomogeneity and/or porosity or cracks. Diffraction methods to evaluate such stress variations are presented. Comparison of the experimental value for the stress with a calculated value of the “diffraction-averaged stress,” on the basis of a model for the local stresses, proved to be a useful method of stress analysis. It is shown that a direct evaluation of occurring stress-depth profiles is less practical. The method of stress analysis proposed, is applied to chemically vapor deposited TiN coatings on Mo substrates. In these coatings a large tensile stress parallel to the surface develops during cooling from the deposition temperature, due to difference in thermal shrink between coating and substrate. As a result of the cooling-induced stress, cracking of the coating occurs. The mesh width of the crack pattern allows determination of the fracture-surface energy and the fracture toughness of the coating material. Conceiving the cracked coatings as assemblies of freestanding columns, and assuming full elastic accommodation of the thermal mismatch at the column/substrate interface, the stress variations in the coating are calculated. On this basis the diffraction-averaged stress and the depth profile of the laterally averaged stress can be predicted accurately for the cracked TiN layers.