The components of the macroscopic mechanical stress tensor of a stressed thin film, coating, multilayer or the region near the surface of a bulk material can in principle be determined by X-ray diffraction. The various analysis methods and measurement strategies, in dependence on specimen and measurement conditions, are summarized and evaluated in this paper. First, different X-ray diffraction geometries (conventional or grazing incidence) are described. Then, the case of macroscopically elastically isotropic, untextured specimens is considered: from the simplest case of a uniaxial state of stress to the most complicated case of a triaxial state of stress. The treatment is organized according to the number of unknowns to be determined (i.e. the state of stress, principal axes known or unknown), the use of one or several values of the rotation angle ' and the tilt angle of the sample, and one or multiple hkl reflections. Next, the focus is on macroscopically elastically anisotropic (e.g. textured) specimens. In this case, the use of diffraction (X-ray) elastic constants is not possible. Instead, diffraction (X-ray) stress factors have to be used. On the basis of examples, it is demonstrated that successful diffraction stress analysis is only possible if an appropriate grain-interaction model is applied.