Laser cooling and trapping are central to modern atomic physics. The workhorse technique in cold-atom physics is the magneto-optical trap (MOT), which combines laser cooling with a restoring force from radiation pressure. For a variety of atomic species, MOTs can capture and cool large numbers of particles to ultracold temperatures (<1 mK); this has enabled the study of a wide range of phenomena from optical clocks to ultracold collisions whilst also serving as the ubiquitous starting point for further cooling into the regime of quantum degeneracy. Magneto-optical trapping of molecules could provide a similarly powerful starting point for the study and manipulation of ultracold molecular gases. Here, we demonstrate three-dimensional magneto-optical trapping of a diatomic molecule, strontium monofluoride (SrF), at a temperature of approximately 2.5 mK. This method is expected to be viable for a significant number of diatomic species. Such chemical diversity is desired for the wide array of existing and proposed experiments which employ molecules for applications ranging from precision measurement, to quantum simulation and quantum information, to ultracold chemistry.