Laser cooling and trapping are central to modern atomic physics. The most used 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 (less than ∼1 millikelvin); this has enabled advances in areas that range from optical clocks to the study of ultracold collisions, while 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. The additional degrees of freedom associated with the vibration and rotation of molecules, particularly their permanent electric dipole moments, allow a broad array of applications not possible with ultracold atoms. Spurred by these ideas, a variety of methods has been developed to create ultracold molecules. Temperatures below 1 microkelvin have been demonstrated for diatomic molecules assembled from pre-cooled alkali atoms, but for the wider range of species amenable to direct cooling and trapping, only recently have temperatures below 100 millikelvin been achieved. The complex internal structure of molecules complicates magneto-optical trapping. However, ideas and methods necessary for creating a molecular MOT have been developed recently. Here we demonstrate three-dimensional magneto-optical trapping of a diatomic molecule, strontium monofluoride (SrF), at a temperature of approximately 2.5 millikelvin, the lowest yet achieved by direct cooling of a molecule. This method is a straightforward extension of atomic techniques and is expected to be viable for a significant number of diatomic species. With further development, we anticipate that this technique may be employed in any number of existing and proposed molecular experiments, in applications ranging from precision measurement to quantum simulation and quantum information to ultracold chemistry.