We report on the discovery of a new member of the magnetar class, SGR J1935+2154, and on its timing and spectral properties measured by an extensive observational campaign carried out between July 2014 and March 2015 with Chandra and XMM-Newton (11 pointings). We discovered the spin period of SGR J1935+2154 through the detection of coherent pulsations at a period of about 3.24s. The magnetar is slowing-down at a rate of 1.43(1)x10^{-11} s/s and with a decreasing trend due to a negative second period derivative of -3.5(7)x10^{-19} s/s^2. This implies a surface dipolar magnetic field strength of about 2.2x10^{14} G, a characteristic age of about 3.6kyr and, a spin-down luminosity L_{sd} of about 1.7x10^{34} erg/s. The source spectrum is well modelled by a blackbody with temperature of about 500eV plus a power-law component with photon index of about 2. The source showed a moderate long-term variability, with a flux decay of about 25\% during the first four months since its discovery, and a re-brightening of the same amount during the second four months. The X-ray data were also used to study the source environment. In particular, we discovered a diffuse emission extending on spatial scales from about 1" up to at least 1' around SGR J1935+2154 both in Chandra and XMM-Newton data. This component is constant in flux (at least within uncertainties) and its spectrum is well modelled by a power-law spectrum steeper than that of the pulsar. Though a scattering halo origin seems to be more probable we cannot exclude that part, or all, of the diffuse emission is due to a pulsar wind nebula.