Ratios of cross sections, σ(Z+c jets)/σ(Z+jets), σ(Z+b jets)/σ(Z+jets), and σ(Z+c jets)/σ(Z+b jets) in the associated production of a Z boson with at least one charm or bottom quark jet are measured in proton-proton collisions at s=13 TeV. The data sample, collected by the CMS experiment at the CERN LHC, corresponds to an integrated luminosity of 35.9 fb-1, with a fiducial volume of pT>30 GeV and |η|<2.4 for the jets, where pT and η represent transverse momentum and pseudorapidity, respectively. The Z boson candidates come from leptonic decays into electrons or muons with pT>25 GeV and |η|<2.4, and the dilepton mass satisfies 71<mZ<111 GeV. The measured values are σ(Z+c jets)/σ(Z+jets)=0.102±0.002±0.009, σ(Z+b jets)/σ(Z+jets)=0.0633±0.0004±0.0015, and σ(Z+c jets)/σ(Z+b jets)=1.62±0.03±0.15. Results on the inclusive and differential cross section ratios as functions of jet and Z boson transverse momentum are compared with predictions from leading and next-to-leading order perturbative quantum chromodynamics calculations. These are the first measurements of the cross section ratios at 13 TeV.