It has been roughly three decades since laser cooling techniques produced ultracold atoms, leading to rapid advances in a wide array of fields. Laser cooling has not yet been extended to molecules because of their complex internal structure. However, this complexity makes molecules potentially useful for a wide range of applications. For example, heteronuclear molecules possess permanent electric dipole moments that lead to long-range, tunable, anisotropic dipole-dipole interactions. The combination of the dipole-dipole interaction and the precise control over molecular degrees of freedom possible at ultracold temperatures makes ultracold molecules attractive candidates for use in quantum simulations of condensed-matter systems and in quantum computation. Also, ultracold molecules could provide unique opportunities for studying chemical dynamics and for tests of fundamental symmetries. Here we experimentally demonstrate laser cooling of the polar molecule strontium monofluoride (SrF). Using an optical cycling scheme requiring only three lasers, we have observed both Sisyphus and Doppler cooling forces that reduce the transverse temperature of a SrF molecular beam substantially, to a few millikelvin or less. At present, the only technique for producing ultracold molecules is to bind together ultracold alkali atoms through Feshbach resonance or photoassociation. However, proposed applications for ultracold molecules require a variety of molecular energy-level structures (for example unpaired electronic spin, Omega doublets and so on). Our method provides an alternative route to ultracold molecules. In particular, it bridges the gap between ultracold (submillikelvin) temperatures and the ~1-K temperatures attainable with directly cooled molecules (for example with cryogenic buffer-gas cooling or decelerated supersonic beams). Ultimately, our technique should allow the production of large samples of molecules at ultracold temperatures for species that are chemically distinct from bialkalis.