A welding machine adapted for performing a spot welding process on a workpiece, wherein the welding machine comprises: - a welding gun including a welding yoke and a pair of opposed electrodes (110, 112) for receiving the workpiece, the pair of electrodes comprising a movable welding tip portion; - a transformer having a primary input side and secondary output side, the secondary output side connected to the pair of electrodes; - a control unit adapted to control the spot welding process, and - a distance detector arranged to detect the distance moved by the movable welding tip portion, wherein the distance detector is connected to the control unit, wherein the control unit is further adapted to: - control the movable welding tip portion, prior to performing the spot welding process, to move towards a welding yoke when the workpiece is positioned between the welding tip portion and a portion of the welding yoke to obtain a sufficient pressure between the welding tip portions, - determine, prior to performing the spot welding process and once the workpiece is arranged with the sufficient pressure between the welding tip portions, a predetermined resistance threshold based on a thickness of the workpiece determined using information received from the distance detector, - control the transformer for applying, prior to performing the spot welding process, a first pre-conditioning welding pulse portion to the workpiece using the welding gun, - receive, from measurement means arranged at the secondary output side of the transformer, an indication of a first voltage and a first current applied in relation to the first pre-conditioning welding pulse portion, - determine a first resistance value based on the indication of the first voltage and the first current, - compare the first resistance value with the predetermined resistance threshold, - control the transformer for applying, prior to performing the spot welding process, a further second pre-conditioning welding pulse portion to the workpiece using the welding gun if the first resistance value is above the predetermined resistance threshold, and - initiate the spot welding process if the first resistance value is below the predetermined resistance threshold. - a welding gun including a welding yoke and a pair of opposed electrodes (110, 112) for receiving the workpiece, the pair of electrodes comprising a movable welding tip portion; - a transformer having a primary input side and secondary output side, the secondary output side connected to the pair of electrodes; - a control unit adapted to control the spot welding process, and - a distance detector arranged to detect the distance moved by the movable welding tip portion, wherein the distance detector is connected to the control unit, - control the movable welding tip portion, prior to performing the spot welding process, to move towards a welding yoke when the workpiece is positioned between the welding tip portion and a portion of the welding yoke to obtain a sufficient pressure between the welding tip portions, - determine, prior to performing the spot welding process and once the workpiece is arranged with the sufficient pressure between the welding tip portions, a predetermined resistance threshold based on a thickness of the workpiece determined using information received from the distance detector, - control the transformer for applying, prior to performing the spot welding process, a first pre-conditioning welding pulse portion to the workpiece using the welding gun, - receive, from measurement means arranged at the secondary output side of the transformer, an indication of a first voltage and a first current applied in relation to the first pre-conditioning welding pulse portion, - determine a first resistance value based on the indication of the first voltage and the first current, - compare the first resistance value with the predetermined resistance threshold, - control the transformer for applying, prior to performing the spot welding process, a further second pre-conditioning welding pulse portion to the workpiece using the welding gun if the first resistance value is above the predetermined resistance threshold, and - initiate the spot welding process if the first resistance value is below the predetermined resistance threshold.