In this paper, we propose a coarse-to-fine image comparison algorithm based on Hausdorff distance for PCB inspection. The Hausdorff distance can be used in a geometrics-based inspection framework for comparing binary edge maps extracted from the inspection images. To use the Hausdorff distance for image alignment, we need to compute the edge map from the input image as the first step. In some cases, one may use directed Hausdorff distance as a similarity measure in order to reduce the computational cost during the image alignment. Moreover, a modified version of directed Hausdorff distance is employed to enforce robustness against random noises introduced by edge detection. The search for the optimal alignment by minimizing the associated Hausdorff distance is accomplished by an efficient multi-resolutional downhill simplex search algorithm. In addition to the image alignment, we also apply a modified Hausdorff distance to detect defects in PCB. In our inspection system, we apply the partial Hausdorff distance in a local circuit window to reduce the inspection area dramatically, thus making it very efficient for PCB inspection. Experimental results on some PCB inspection examples are shown to demonstrate the accuracy and efficiency of the proposed Hausdorff-distance based inspection system.