An automatic, accurate mask alignment method, based on a modified moiré technique suitable for x-ray lithography is presented. In this technique, the alignment marks are in the form of gratings. The high slope region of the moiré signal is used to obtain higher sensitivity and better position control accuracy. Automatic alignment is achieved by using the difference of the moiré signal and its inverted signal obtained by computer. This difference signal is zero at a point in the higher slope region that is considered the correct alignment point. This difference signal is treated as an error signal, which is used for obtaining control signal by performing the proportional, integration and differential (PID) algorithm. The 12-bit analog-to-digital (A/D) and digital-to-analog (D/A) convertors are used to interface the piezoelectric-transducer- (PZT)-driven alignment system with the computer. Under the present experimental conditions, accuracy for alignment is of the order of ± 0.06 μm.