Measurements are presented of the associated production of a W boson and a charm-quark jet (W + c) in pp collisions at a center-of-mass energy of 7 TeV. The analysis is conducted with a data sample corresponding to a total integrated luminosity of 5 fb(-1), collected by the CMS detector at the LHC. W boson candidates are identified by their decay into a charged lepton (muon or electron) and a neutrino. The W + c measurements are performed for charm-quark jets in the kinematic region p(T)(jet) > 25 GeV, vertical bar eta(jet)vertical bar < 2.5, for two different thresholds for the transverse momentum of the lepton from the W-boson decay, and in the pseudorapidity range eta(l) < 2.1. Hadronic and inclusive semileptonic decays of charm hadrons are used to measure the following total cross sections: sigma(pp -> W + c + X) x B (W -> lv) = 107.7 +/- 3.3 (stat.) +/- 6.9 (syst.) pb (p(T)(l) > 25 GeV) and sigma (pp -> W + c + X) x B (W -> lv) = 84.1 +/- 2.0 (stat.) +/- 4.9 (syst.) pb (p(T)(l) > 35 GeV), and the cross section ratios sigma(pp -> W+ + (c) over bar + X)/sigma(pp -> W- + c + X) = 0.954 +/- 0.025 (stat.) +/- 0.004 (syst.) (p(T)(l) > 25 GeV) and sigma(pp -> W+ + (c) over bar + X)/sigma(pp -> W- + c + X) = 0.938 +/- 0.019 (stat.) +/- 0.006 (syst.) (p(T)(l) > 35 GeV). Cross sections and cross section ratios are also measured differentially with respect to the absolute value of the pseudorapidity of the lepton from the W-boson decay. These are the first measurements from the LHC directly sensitive to the strange quark and antiquark content of the proton. Results are compared with theoretical predictions and are consistent with the predictions based on global fits of parton distribution functions.