The quantized version of the anomalous Hall effect has been predicted to occur in magnetic topological insulators, but the experimental realization has been challenging. Here, we report the observation of the quantum anomalous Hall (QAH) effect in thin films of chromium-doped (Bi,Sb)2Te3, a magnetic topological insulator. At zero magnetic field, the gate-tuned anomalous Hall resistance reaches the predicted quantized value of h/e(2), accompanied by a considerable drop in the longitudinal resistance. Under a strong magnetic field, the longitudinal resistance vanishes, whereas the Hall resistance remains at the quantized value. The realization of the QAH effect may lead to the development of low-power-consumption electronics.