Any variation in the fundamental physical constants, more particularly in the fine structure constant, α, or in the mass of the electron, me, affects the recombination history of the Universe and cause an imprint on the cosmic microwave background angular power spectra. We show that the Planck data allow one to improve the constraint on the time variation of the fine structure constant at redshift z ∼ 103 by about a factor of 5 compared to WMAP data, as well as to break the degeneracy with the Hubble constant, H0. In addition to α, we can set a constraint on the variation in the mass of the electron, me, and in the simultaneous variation of the two constants. We examine in detail the degeneracies between fundamental constants and the cosmological parameters, in order to compare the limits obtained from Planck and WMAP and to determine the constraining power gained by including other cosmological probes. We conclude that independent time variations of the fine structure constant and of the mass of the electron are constrained by Planck to Δα/α = (3.6 ± 3.7) × 10-3 and Δme/me = (4 ± 11) × 10-3 at the 68% confidence level. We also investigate the possibility of a spatial variation of the fine structure constant. The relative amplitude of a dipolar spatial variation in α (corresponding to a gradient across our Hubble volume) is constrained to be δα/α = (-2.4 ± 3.7) × 10-2.