A method for in-situ joint nanoscale three-dimensional imaging and chemical analysis of a sample. A single charged particle beam device is used for generating a sequence of two-dimensional nanoscale images of the sample, and for sputtering secondary ions from the sample, which are analysed using a secondary ion mass spectrometry device. The two-dimensional images are combined into a three-dimensional volume representation of the sample, the data of which is combined with the results of the chemical analysis.