In this work the charm and bottom quark masses are determined from QCD moment sum rules for the charmonium and upsilon systems. In our analysis we include both the results from non-relativistic QCD and perturbation theory at next-next-to-leading order. For the pole masses we obtain M c = 1.75 ± 0.15 GeV and M b = 4.98 ± 0.125 GeV. Using the potential-subtracted mass in intermediate steps of the calculation the MS -masses are determined to m c ( m c ) = 1.19 ± 0.11 GeV and m b ( m b ) = 4.24 ± 0.10 GeV.