Optical magnetometers have reached sensitivities that make them interesting candidates for the measurement of weak magnetic fields also outside physics laboratories. In order to overcome problems with stray magnetic fields a common solution with existing magnetometers is to operate a pair of them in a gradiometer configuration: one sensor measures the signal plus the stray fields, while the other one is mounted such that it is only influenced by the stray fields. In the difference signal the stray fields cancel. We have constructed such a gradiometer consisting of two sensors based on coherent population trapping (CPT) resonances in a thermal cesium vapor. Using a magnetic bias field the intrinsically scalar CPT magnetometer can be turned into a true vector magnetometer that is insensitive to magnetic fields perpendicular to a chosen measurement direction. We describe how to align and calibrate the gradiometer. Stray field suppression by more than two orders of magnitude has been achieved, limited by the sensitivity of the magnetometer. This makes possible the detection of picotesla flux density changes in a weakly shielded or even unshielded environment.