The relaxation dynamics of the contact angle between a viscous liquid and a smooth substrate is studied at the nanoscale. Through atomic force microscopy measurements of polystyrene nanostripes we simultaneously monitor both the temporal evolution of the liquid-air interface and the position of the contact line. The initial configuration exhibits high curvature gradients and a non-equilibrium contact angle that drive liquid flow. Both these conditions are relaxed to achieve the final state, leading to three successive regimes in time: (i) stationary contact line levelling; (ii) receding contact line dewetting; (iii) collapse of the two fronts. For the first regime, we reveal the existence of a self-similar evolution of the liquid interface, which is in excellent agreement with numerical calculations from a lubrication model. For different liquid viscosities and film thicknesses we provide evidence for a transition to dewetting featuring a universal critical contact angle and dimensionless time.