A measurement of the electron charge asymmetry in inclusive pp -> W + X -> ev + X production at root s = 7 TeV is presented based on data recorded by the CMS detector at the LHC and corresponding to an integrated luminosity of 840 pb(-1). The electron charge asymmetry reflects the unequal production of W+ and W- bosons in pp collisions. The electron charge asymmetry is measured in bins of the absolute value of electron pseudorapidity in the range of vertical bar eta vertical bar < 2.4. The asymmetry rises from about 0.1 to 0.2 as a function of the pseudorapidity and is measured with a relative precision better than 7%. This measurement provides new stringent constraints for parton distribution functions.