Context. Chemically peculiar Ap stars are main-sequence stars of spectral type B8-F3 which show large overabundances of some chemical elements (e.g., Si, Sr, Cr), especially of rare-earth elements, compared to normal A-type stars. Furthermore, they have strong, global magnetic fields and low rotational velocities. Some Ap stars exhibit high-overtone, low-degree, non-radial p-mode pulsations with periods of 6-24 min and are called rapidly oscillating Ap (roAp) stars. Interestingly, no roAp star is known to be a spectroscopic binary (SB), while many non-oscillating Ap (noAp) stars are found in SB systems. Aims. The goal of this survey was to carry out a systematic search for sub-stellar and stellar companions around Ap stars. Methods. Between 2004 and 2009, we observed 65 chemically peculiar stars with the HARPS spectrograph at the 3.6-m telescope at the European Southern Observatory (La Silla, Chile). The radial-velocity (RV) measurements were obtained using a new software called HARPS-TERRA which is based on a least-squares matching of each individual spectrum to a high signal-to-noise ratio template for each star. Results. We find significant variability with a period of 93.2 days and a semi-amplitude of 11.85 km s −1 in the RVs of HD 42659, a star of our sample that belongs to the group of roAp stars. This variability is caused by a stellar companion with a minimum mass of 0.47 M in a slightly eccentric (e = 0.146) orbit at a separation of 0.55 AU.Conclusions. This detection makes HD 42659 the first confirmed SB around a roAp star in a relatively close orbit. It shows that tidal interactions in binaries do not necessarily inhibit pulsations in Ap stars.