The bispectrum of the microwave background sky is a possible discriminator between inflationary and defect models of structure formation in the Universe. The bispectrum, which is the analogue of the temperature 3-point correlation function in harmonic space, is zero for most inflationary models, but non-zero for non-gaussian models. The expected departures from zero are small, and easily masked by noise, so it is important to be able to estimate the bispectrum coefficients as accurately as possible, and to know the errors and correlations between the estimates so they may be used in combination as a diagnostic to rule out non-gaussian models. This paper presents a method for estimating in an unbiased way the bispectrum from a microwave background map in the near-gaussian limit. The method is optimal, in the sense that no other method can have smaller error bars, and in addition, the covariances between the bispectrum estimates are calculated explicitly. The method deals automatically with partial sky coverage and arbitrary noise correlations without modification. A preliminary application to the Cosmic Background Explorer 4-year dataset shows no evidence for non-gaussian behaviour.