A method includes producing a preform of a guide rail from steel, putting the preform in a holding device so that the preform is held fixed in position, analyzing the preform held in the holding device, a deviation from a straight shape being measured at a plurality of locations along the longitudinal axis. The method further includes irradiating the preform held in the holding device with a laser beam, a surface section being irradiated with the laser beam along the longitudinal axis at a plurality of locations, respectively on one of two side surfaces facing in opposite directions in relation to the first transverse axis, in such a way that it is heated into the plastic range.