The transverse momentum spectra of weak vector bosons are measured in the CMS experiment at the LHC. The measurement uses a sample of proton-proton collisions at sqrt(s) = 8 TeV, collected during a special low-luminosity running that corresponds to an integrated luminosity of 18.4 +/- 0.5 inverse picobarns. The production of W bosons is studied in both electron and muon decay modes, while the production of Z bosons is studied using only the dimuon decay channel. The ratios of W- to W+ and Z to W differential cross sections are also measured. The measured differential cross sections and ratios are compared with theoretical predictions up to next-to-next leading order in QCD.