We present a study of the upper critical field of the newly discovered heavy fermion superconductor UTe$_2$ by magnetoresistivity measurements in pulsed magnetic fields up to 60~T and static magnetic fields up to 35~T. We show that superconductivity survives up to the metamagnetic transition at $H_{rm m} approx 35$~T at low temperature. Above $H_{rm m}$ superconductivity is suppressed. At higher temperature superconductivity is enhanced under magnetic field leading to reentrance of superconductivity or an almost temperature independent increase of $H_{rm c2}$. By studying the angular dependence of the upper critical field close to the $b$ axis (hard magnetization axis) we show that the maximum of the reentrant superconductivity temperature is depinned from the metamagnetic field. A key ingredient for the field-reinforcement of superconductivity on approaching $H_{rm m}$ appears to be an immediate interplay with magnetic fluctuations and a possible Fermi-surface reconstruction.