Calibration of the relative response of the individual channels of the barrel electromagnetic calorimeter of the CMS detector was accomplished, before installation, with cosmic ray muons and test beams. One fourth of the calorimeter was exposed to a beam of high energy electrons and the relative calibration of the channels, the intercalibration, was found to be reproducible to a precision of about 0.3%. Additionally, data were collected with cosmic rays for the entire ECAL barrel during the commissioning phase. By comparing the intercalibration constants obtained with the electron beam data with those from the cosmic ray data, it is demonstrated that the latter provide an intercalibration precision of 1.5% over most of the barrel ECAL. The best intercalibration precision is expected to come from the analysis of events collected in situ during the LHC operation. Using data collected with both electrons and pion beams, several aspects of the intercalibration procedures based on electrons or neutral pions were investigated.