We present measurements of the superconducting upper critical field H-c2(T) and the magnetic phase diagram of the superconductor ErNi2B2C made with a scanning tunneling microscope (STM). The magnetic field was applied in the basal plane of the tetragonal crystal structure. We have found large gapless regions in the superconducting phase diagram of ErNi2B2C, extending between different magnetic transitions. A close correlation between magnetic transitions and H-c2(T) is found, showing that superconductivity is strongly linked to magnetism. (C) 2012 Elsevier Ltd. All rights reserved.