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.24 s. The magnetar is slowing-down at a rate of \dot { P } = 1.43 ( 1 ) \times 10 ^ { -11 } s s ^ { -1 } and with a decreasing trend due to a negative \ddot { P } of -3.5 ( 7 ) \times 10 ^ { -19 } s s ^ { -2 } . This implies a surface dipolar magnetic field strength of \sim 2.2 \times 10 ^ { 14 } G , a characteristic age of about 3.6 kyr and , a spin-down luminosity L _ { sd } \sim 1.7 \times 10 ^ { 34 } erg s ^ { -1 } . The source spectrum is well modelled by a blackbody with temperature of about 500 eV 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 ^ { \prime \prime } up to at least 1 ^ { \prime } 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 can not exclude that part , or all , of the diffuse emission is due to a pulsar wind nebula .