The relative motion of lithospheric plates and underlying mantle produces localized deformation near the lithosphere-asthenosphere boundary. The transition from rheologically stronger lithosphere to weaker asthenosphere may result from a small amount of melt or water in the asthenosphere, reducing viscosity. Either possibility may explain the seismic and electrical anomalies that extend to a depth of about 200 kilometres. However, the effect of melt on the physical properties of deformed materials at upper-mantle conditions remains poorly constrained. Here we present electrical anisotropy measurements at high temperatures and quasi-hydrostatic pressures of about three gigapascals on previously deformed olivine aggregates and sheared partially molten rocks. For all samples, electrical conductivity is highest when parallel to the direction of prior deformation. The conductivity of highly sheared olivine samples is ten times greater in the shear direction than for undeformed samples. At temperatures above 900 degrees Celsius, a deformed solid matrix with nearly isotropic melt distribution has an electrical anisotropy factor less than five. To obtain higher electrical anisotropy (up to a factor of 100), we propose an experimentally based model in which layers of sheared olivine are alternated with layers of sheared olivine plus MORB or of pure melt. Conductivities are up to 100 times greater in the shear direction than when perpendicular to the shear direction and reproduce stress-driven alignment of the melt. Our experimental results and the model reproduce mantle conductivity-depth profiles for melt-bearing geological contexts. The field data are best fitted by an electrically anisotropic asthenosphere overlain by an isotropic, high-conductivity lowermost lithosphere. The high conductivity could arise from partial melting associated with localized deformation resulting from differential plate velocities relative to the mantle, with subsequent upward melt percolation from the asthenosphere.