We study the spatial clustering of 538 X-ray selected AGN in the 2 deg ^ { 2 } XMM-COSMOS field that are spectroscopically identified with I _ { AB } < 23 and span the redshift range z = 0.2 - 3.0 . The median redshift and luminosity of the sample are z = 0.98 and L _ { 0.5 - 10 } = 6.3 \times 10 ^ { 43 } erg s ^ { -1 } , respectively . A strong clustering signal is detected at \sim 18 \sigma level , which is the most significant measurement obtained to date for clustering of X-ray selected AGN . By fitting the projected correlation function w ( r _ { p } ) with a power law on scales of r _ { p } = 0.3 - 40 h ^ { -1 } Mpc , we derive a best-fit comoving correlation length of r _ { 0 } = 8.6 \pm 0.5 h ^ { -1 } Mpc and slope of \gamma = 1.88 \pm 0.07 ( Poissonian errors ; bootstrap errors are about a factor of 2 larger ) . An excess signal is observed in the range r _ { p } \sim 5 - 15 h ^ { -1 } Mpc , which is due to a large-scale structure at z \sim 0.36 containing about 40 AGN , a feature which is evident over many wavelengths in the COSMOS field . When removing the z \sim 0.36 structure or computing w ( r _ { p } ) in a narrower range around the peak of the redshift distribution ( e.g . z = 0.4 - 1.6 ) , the correlation length decreases to r _ { 0 } \sim 5 - 6 h ^ { -1 } Mpc , which is consistent with what is observed for bright optical QSOs at the same redshift . We investigate the clustering properties of obscured and unobscured AGN separately , adopting different definitions for the source obscuration . For the first time , we are able to provide a significant measurement for the spatial clustering of obscured AGN at z \sim 1 . Within the statistical uncertainties , we do not find evidence that AGN with broad optical lines ( BLAGN ) cluster differently from AGN without broad optical lines ( non-BLAGN ) . Based on these results , which are limited by object statistics , however , obscured and unobscured AGN are consistent with inhabiting similar environments . The evolution of AGN clustering with redshift is also investigated . No significant difference is found between the clustering properties of XMM-COSMOS AGN at redshifts below or above z = 1 . The correlation length measured for XMM-COSMOS AGN at z \sim 1 is similar to that of massive galaxies ( stellar mass M _ { \star } \gtrsim 3 \times 10 ^ { 10 } M _ { \odot } ) at the same redshift . This suggests that AGN at z \sim 1 are preferentially hosted by massive galaxies , as observed both in the local and in the distant ( z \sim 2 ) Universe . According to a simple clustering evolution scenario , we find that the relics of AGN are expected to have a correlation length as large as r _ { 0 } \sim 8 h ^ { -1 } Mpc by z = 0 , and hence to be hosted by local bright ( L \sim L _ { \star } ) ellipticals . We make use of dark matter halo catalogs from the Millennium simulation to determine the typical halo hosting moderately luminous z \sim 1 AGN . We find that XMM-COSMOS AGN live in halos with masses M \gtrsim 2.5 \times 10 ^ { 12 } M _ { \odot } h ^ { -1 } . By combining the number density of XMM-COSMOS AGN to that of the hosting dark matter halos we estimate the AGN duty cycle and lifetimes . We find lifetimes approximately of 1 Gyr for AGN at z \sim 1 , which are longer than those estimated for optically bright QSOs at the same redshift . These longer lifetimes mainly reflect the higher number density of AGN selected by X-ray samples .