A water-soluble salt of a metal with a high atomic weight is selected as an X-ray contrast substance providing a selective ion-exchange reaction with a component. The salt has a general formula R+M−, where R+ is selected from a group consisting of Ba2+; Sr2+; Tl+; Rb+ . . . , and M− is selected from a group consisting of Cln; NOn; OHn; CH3COO, SO4; . . . in accordance with a standard table of inorganic substances' water solubility. The X-ray contrast substance is injected into a sample of a porous material. Upon completion of the selective ion exchange reaction a non-contrast displacing agent is injected into the sample. The sample is scanned by computer X-ray microtomography and spatial distribution and concentration of the component in question is estimated by analysis of the obtained computer tomographic image of the sample.