We report a proof-of-principle demonstration of a probabilistic controlled-NOT gate for single photons. Single-photon control and target qubits were mixed with a single ancilla photon in a device constructed using only linear optical elements. The successful operation of the controlled-NOT gate relied on post-selected three-photon interference effects which required the detection of the photons in the output modes.