TODCOR is a new TwO-Dimensional CORrelation technique to measure radial velocities of two components of a spectroscopic binary. Assuming the spectra of the two components are known, the technique correlates an observed binary spectrum against a combination of the two spectra with different shifts. TODCOR measures simultaneously the radial velocities of the two stars by finding the maximum correlation. One of the advantages of TODCOR is its ability to detect a very faint companion in a combined spectrum, and to measure its radial velocity. We performed numerous tests in which we applied TODCOR to simulated spectra which were prepared as combinations of two spectra with various luminosity ratios, together with random noise. These tests show that TODCOR can detect a very faint secondary spectrum and measure correctly its velocity, even with a luminosity ratio of 1000, provided the combined spectrum has enough spectral coverage and high S / N. Measuring the radial velocity of the faint secondary will enable us to estimate the companion mass, a very useful tool in the search for brown dwarfs and giant planets around nearby stars.