The period changes of 86 M5 RR Lyrae stars have been investigated on a 100-yr time base. The published observations have been supplemented by archival Asiago, Konkoly and Las Campanas photographic observations obtained between 1952 and 1993. About two-thirds of the O − C diagrams could be fitted by a straight line or a parabola. 21 RR Lyrae stars have increasing, 18 decreasing and 16 constant period. The mean rates of period change of these variables are: . 10 RR Lyrae stars show fast period decrease with . At least some of these variables may be in the pre-zero-age horizontal-branch (ZAHB) evolutionary stage. The variables on the long-period sequence of the period–amplitude diagram are brighter than the other RR Lyrae stars of M5 and are in an advanced evolutionary stage moving off from the HB redward. More than one-third of the M5 RR Lyrae stars investigated have irregular period change. The irregular period behaviour is relatively more frequent among the RRc (RR1) stars (50 per cent) than among the RRab (RR0) stars (34 per cent). A strict relationship has been found between the irregular period change and the Blazhko effect of M5 RRab stars. This fact indicates a common origin for these phenomena. It is remarkable that, if the RRab stars showing Blazhko effect are omitted from the sample, the mean rates of the period change have small positive values (〈β〉= 0.012 ± 0.147 d Myr-1, 〈α〉= 0.013 ± 0.279 Myr−1), in excellent agreement with HB evolutionary model predictions.