The application of X-rays to the structural characterization of surfaces and interfaces, in situ and in UHV, is discussed on selected examples. Grazing incidence X-ray diffraction is not only a very powerful technique for quantitatively investigating the atomic structure of surfaces and interfaces, but is also very useful for providing information on the interfacial registry for coherent interfaces or on the strain deformation, island and grain sizes for incoherent epilayers.