Many physics analyses using the Compact Muon Solenoid (CMS) detector at the LHC require accurate, high resolution electron and photon energy measurements. Particularly important are decays of the Higgs boson resulting in electromagnetic particles in the final state, as well as searches for very high mass resonances decaying to energetic photons or electrons. Following the excellent performance achieved in Run I at center-of-mass energies of 7 and 8 TeV, the CMS electromagnetic calorimeter (ECAL) is operating at the LHC with proton-proton collisions at 13 TeV center-of-mass energy. The instantaneous luminosity delivered by the LHC during Run II has achieved unprecedented values, using 25 ns bunch spacing. High pileup levels necessitate a retuning of the ECAL readout and trigger thresholds and reconstruction algorithms, to maintain the best possible performance in these more challenging conditions. The energy response of the detector must be precisely calibrated and monitored to achieve and maintain the excellent performance obtained in Run I in terms of energy scale and resolution. A dedicated calibration of each detector channel is performed with physics events exploiting electrons from W and Z boson decays, photons from pi0/eta decays, and from the azimuthally symmetric energy distribution of minimum bias events. This talk describes the calibration strategies and performance of the CMS ECAL throughout Run II and its role in precision physics measurements with CMS involving electrons and photons.