A method is described for automatically focusing a high-power optical microscope using an extremum controller. The principle used is that of maximising the amplitudes of certain high-frequency components of a signal derived by scanning the object. The optimum bandpass filter required in selecting these frequency components is derived on the basis of expected power spectra, and the reasons for deviating, somewhat from this optimum are explained on the basis of the statistical variations in harmonic amplitudes of practical objects. A practicable system employing a peak-holding controller is described, in which the average hunting excursion about focus is less than the normally accepted depth of focus of the optical system.