Based on the moire effect and the Fresnel diffraction theory, a novel technique for diagnosing the beam properties is presented and analyzed, which is especially suitable for X-ray lasers. The method makes it possible, in a one-shot experimental measurement, to determine the beam quality factor M-2, the effective radius of curvature, the beam width, the far-field divergence, and the waist location and radius as well as the spatial coherence and its evolution. Numerical simulation proves the validity of the method. Note that the novel moire technique opens an efficient road, for the first time, to fully diagnose the spatial properties of X-ray lasers.