The production of J/ψ and Υ mesons in pp collisions at s√=8 TeV is studied with the LHCb detector. The J/ψ and Υ mesons are reconstructed in the μ + μ − decay mode and the signal yields are determined with a fit to the μ + μ − invariant mass distributions. The analysis is performed in the rapidity range 2. 0 < y < 4. 5 and transverse momentum range 0 < p T < 14 (15) GeV/c of the J/ψ (Υ) mesons. The J/ψ and Υ production cross-sections and the fraction of J/ψ mesons from b-hadron decays are measured as a function of the meson p T and y.