Optical performance, i.e. the diffraction efficiency, numerical aperture and wave front quality is of great importance for further successful application of diffractive optical elements in a wide range of research and commercial applications. For the fabrication process, simultaneously large numerical aperture and high diffraction efficiency result in a pattern with sub-wavelength resolution and a multi-level phase profile of nanometer accuracy. To fulfill such high requirements, a multi-step fabrication technique is proposed, in which the electron beam is used both for pattern writing and layout alignment. This method enables the fabrication of a structure with the L = 2 n discrete phase levels in n sequential lithographic steps. In each step, the pattern written in a thin, high contrast resist layer is transferred after development into the substrate by reactive ion etching to form the phase profile. In comparison to the multi-mask binary optics technology, the proposed method offers a higher resolution and reduces the alignment errors to insignificant values. On the other hand, in comparison to the direct write analog technique, our approach allows for a much better control of the phase profile and ensures larger process tolerances. The method has been successfully applied in the fabrication of several types of diffractive elements, including micro-Fresnel lens arrays, phase sampling filters and diffraction gratings on quartz and GaAs wafers. The diffraction efficiencies of these elements were found to be up to 92%. The lens exhibited diffraction-limited focusing characteristics and an insignificant wave front aberration (rms 0.01 λ).