This thesis covers different aspects of the Compact Muon Solenoid (CMS) operation and data analysis, always with muons as the common factor. The calibration and characterization of the drift tube chambers (DTs), one of CMS muon detectors, carried out in the pre-collision era, is presented in this thesis. To complete the calibration of the muon detection and measurement the calibration of muon momentum using electroweak data is shown. In particular, the clean sample that Z bosons coming from collisions represent is used to study the momentum scale and resolution of the CMS muon spectrometer.