We investigate the application, for X-ray astronomy, of a source detection algorithm similar to the so-called matched filter (MF) technique. From the instrument point-spread function (PSF) we construct filters which are much closer to optimal for point-source detection than are the square functions used in the traditional sliding box (SE) method and at the same time ensure local background subtraction. We develop the technique primarily for use with the ROSAT PSPC images. Through intensive Monte Carlo simulations we calibrate the method for the real PSPC PSF and the values of background intensity typically found for medium and deep exposure (>10,000 s) ROSAT fields. From the simulations, all those functions necessary to correct the measured source intensities and the number-flux relation (log N-log S) are derived. It is shown that, indeed, we are able to obtain unbiased estimates of source intensities and the log N-log S function down to S/N similar to 2, as long as the PSPC PSF approximation we use is valid. We compare our method with the SE technique, as it is traditionally used, and find that the MF algorithm always works significantly better than the SE method. In particular, the latter overestimates the source fluxes and the log N-log S function near the detection threshold and therefore requires additional calibrations to correct for these biases.