We carried out a multiwavelenght study of the black-hole candidate LMC X-3 with XMM-Newton. The system showed a transition to a low-hard state, in which the X-ray spectrum was well fitted by a simple power law. It then returned to a high-soft state, characterised by a strong disk-blackbody component. The line-of-sight absorption column density is <~ 4 x 10^{20} cm^{-2} consistent with the foreground Galactic absorption. This rules out wind accretion. We argue that, despite LMC X-3 being a high-mass X-ray binary, Roche-lobe overflow is the main mechanism of mass transfer. From UV/optical observations in the low-hard state, we determine that the companion is a slightly evolved B5 star with a mass M ~ 4.5 M_sun. This is indeed consistent with the secondary star being close to filling its Roche lobe.