About 50 per cent of all known hot subdwarf B stars (sdBs) reside in close (short-period) binaries, for which common-envelope ejection is the most likely formation mechanism. However, Han et al. predict that the majority of sdBs should form through stable mass transfer leading to long-period binaries. Determining orbital periods for these systems is challenging and while the orbital periods of ∼100 short-period systems have been measured, there are no periods measured above 30 d. As part of a large programme to characterize the orbital periods of sdB binaries and their formation history, we have found that PG 1018−047 has an orbital period of 759.8 ± 5.8 d, easily making it the longest period ever detected for a sdB binary. Exploiting the Balmer lines of the subdwarf primary and the narrow absorption lines of the companion present in the spectra, we derive the radial velocity amplitudes of both stars, and estimate the mass ratio MMS/MsdB= 1.6 ± 0.2. From the combination of visual and infrared photometry, the spectral type of the companion star is determined to be mid-K.