Focusing is a critical requirement in optical microlithography. The high resolution required calls for a large relative aperture, and this in turn shortens the depth of focus. Depth of focus on the order of the wavelength of light is a major technical problem, especially if one does not impose narrow tolerances on the flatness of the substrate. Here we report on a capacitive focusing method that makes feasible focusing accuracies to a fraction of a micrometer, automatically if desired. The theory, an implementation, and results obtained are presented.