Quantum fluctuations create intermolecular forces that pervade macroscopic bodies. At molecular separations of a few nanometres or less, these interactions are the familiar van der Waals forces. However, as recognized in the theories of Casimir, Polder and Lifshitz, at larger distances and between macroscopic condensed media they reveal retardation effects associated with the finite speed of light. Although these long-range forces exist within all matter, only attractive interactions have so far been measured between material bodies. Here we show experimentally that, in accord with theoretical prediction, the sign of the force can be changed from attractive to repulsive by suitable choice of interacting materials immersed in a fluid. The measured repulsive interaction is found to be weaker than the attractive. However, in both cases the magnitude of the force increases with decreasing surface separation. Repulsive Casimir-Lifshitz forces could allow quantum levitation of objects in a fluid and lead to a new class of switchable nanoscale devices with ultra-low static friction.