Topological gluon configurations in quantum chromodynamics induce quark chirality imbalance in local domains, which can result in the chiral magnetic effect (CME)--an electric charge separation along a strong magnetic field. Experimental searches for the CME in relativistic heavy ion collisions via the charge-dependent azimuthal correlator ($Deltagamma$) suffer from large backgrounds arising from particle correlations (e.g. due to resonance decays) coupled with the elliptic anisotropy. We propose differential measurements of the $Deltagamma$ as a function of the pair invariant mass ($m_{rm inv}$), by restricting to high $m_{rm inv}$ thus relatively background free, and by studying the $m_{rm inv}$ dependence to separate the possible CME signal from backgrounds. We demonstrate by model studies the feasibility and effectiveness of such measurements for the CME search.