As electric current flows through the electrodes, pressure is applied to hold it together. The resistance of the material that's to be welded is much higher than the electrodes, resulting in sufficient heat to melt the metal. The pressure is held long enough to allow the material to solidify.