A measurement of the forward-backward asymmetry (A[FB]) of Drell-Yan lepton pairs in pp collisions at sqrt(s) = 7 TeV is presented. The data sample, collected with the CMS detector, corresponds to an integrated luminosity of 5 inverse femtobarns. The asymmetry is measured as a function of dilepton mass and rapidity in the dielectron and dimuon channels. Combined results from the two channels are also presented. The AFB measurement in the dimuon channel and the combination of the two channels are the first such results obtained at a hadron collider. The measured asymmetries are consistent with the standard model predictions.