We estimate the two- and three-dimensional power spectra, PAK) and PA), of the galaxy distribution by applying a maximum likelihood estimator to pixel maps of the APM Galaxy Survey. The analysis provides optimal estimates of the power spectra and of their covariance matrices if the fluctuations are assumed to be Gaussian. Our estimates of P-2(K) and P-3(k) are in good agreement with previous work, but we find that the errors at low wavenumbers have been underestimated in some earlier studies. If the galaxy power spectrum is assumed to have the same shape as the mass power spectrum, then the APM maximum likelihood PA) estimates at k less than or equal to 0.19 h Mpc(-1) constrain the amplitude and shape parameter of a scale-invariant CDM model to lie within the 2 sigma ranges 0.74 less than or equal to (sigma (8)) less than or equal to 1.28 and 0.06 less than or equal to Gamma less than or equal to 0.46. Using the Galactic extinction estimates of Schlegel, Finkbeiner & Davis, we show that Galactic obscuration has a negligible effect on galaxy clustering over most of the area of the APM Galaxy Survey.