Noise is a major issue influencing quantitative analysis in diffusion MRI. The effects of noise can be reduced by repeated acquisitions,but this leads to long acquisition times that can be unrealistic in clinical settings. For this reason,post-acquisition denoising methods have been widely used to improve SNR. Among existing methods,nonlocal means (NLM) has been shown to produce good image quality with edge preservation. However,currently the application of NLM to diffusion MRI has been mostly focused on the spatial space (i.e.,the x-space),despite the fact that diffusion data live in a combined space consisting of the x-space and the q-space (i.e.,the space of wavevectors). In this paper,we propose to extend NLM to both x-space and q-space. We show how patch-matching,as required in NLM,can be performed concurrently in x-q space with the help of azimuthal equidistant projection and rotation invariant features. Extensive experiments on both synthetic and real data confirm that the proposed x-q space NLM (XQ-NLM) outperforms the classic NLM.