The leading-order process for the production of a Z boson and a heavy-quark jet at hadron colliders is gQ -> ZQ (Q=c,b). We calculate this cross section at next-to-leading order at the Tevatron and the LHC, and compare it with other sources of ZQ events. This process is a background to new physics, and can be used to measure the heavy-quark distribution function.