The rapid formation of an electron internal transport barrier (eITB) is observed during a slow evolution (similar or equal to 200 ms) from a centrally peaked to a hollow current density profile, while all external actuators remain constant. The time constant for the barrier formation appears to be shorter than the electron energy confinement time. The improved confinement associated with the barrier formation occurs first in a localized region off-axis. Then the effects propagate to inner and outer flux surfaces on a confinement time scale. The temporal and spatial localizations of the barrier formation suggest a threshold in the magnetic shear profile that triggers the onset of the eITB. The threshold-like behaviour can be attributed to the sudden appearance of a minimum q (or zero-shear) flux surface in the safety factor profile. Based on modelling of the current profile evolution using the ASTRA transport code, the appearance of the zero-shear flux surface is correlated with the temporal and spatial formation of the barrier.