Motivated by the question of which kind of physical interactions and processes are needed for the production of quantum entanglement, Peres has put forward the radical idea of delayed-choice entanglement swapping. There, entanglement can be ‘produced a posteriori, after the entangled particles have been measured and may no longer exist’. Here, we report the realization of Peres’s gedanken experiment. Using four photons, we can actively delay the choice of measurement—implemented through a high-speed tunable bipartite-state analyser and a quantum random-number generator—on two of the photons into the time-like future of the registration of the other two photons. This effectively projects the two already registered photons onto one of two mutually exclusive quantum states in which the photons are either entangled (quantum correlations) or separable (classical correlations). This can also be viewed as ‘quantum steering into the past’.