Magnetic fields play an important (sometimes dominant) role in the evolution of gas clouds in the Galaxy, but the strength and orientation of the field in the interstellar medium near the heliosphere has been poorly constrained. Previous estimates of the field strength range from 1.8-2.5μG and the field was thought to be parallel to the Galactic plane or inclined by 38-60° (ref. 2) or 60-90° (ref. 3) to this plane. These estimates relied either on indirect observational inferences or modelling in which the interstellar neutral hydrogen was not taken into account. Here we report measurements of the deflection of the solar wind plasma flows in the heliosheath to determine the magnetic field strength and orientation in the interstellar medium. We find that the field strength in the local interstellar medium is 3.7-5.5μG. The field is tilted ~20-30° from the interstellar medium flow direction (resulting from the peculiar motion of the Sun in the Galaxy) and is at an angle of about 30° from the Galactic plane. We conclude that the interstellar medium field is turbulent or has a distortion in the solar vicinity.