The structure factor provides a fundamental characterization of porous and granular materials as it is the key for solid crystals via measurements of x-ray and neutron scattering. Here, we demonstrate that the structure factor of the granular and porous media can be approximated by the pair correlation function of the inhomogeneous internal magnetic field, which arises from the susceptibility difference between the pore filling liquid and the solid matrix. In-depth understanding of the internal field is likely to contribute to further development of techniques to study porous and granular media. DOI: 10.1103/PhysRevLett.100.025501 PACS numbers: 76.60.Jx, 61.05.Qr, 61.43.Gt, 75.75.+a Sand piles, rocks, and colloids share a common structure element that they are examples of materials formed by aggregation of granular particles in another medium. Their physical properties are critically dependent on the grain-grain interactions and the structure of the grain arrangement [1][2][3]. Details of the packing are important for the presence of heterogeneous force causing jamming [4,5], unique acoustic properties [6], and clustering [1]. It was found that the spatial correlation functions of the electromagnetic fields in such porous media can be useful to predict fluid flow and structure factor. For example, twodimensional images have been used to construct the spatial correlation functions of porous media and to infer material properties [7][8][9][10], and it was shown that correlation length of electric field is similar to the hydraulic radius [11]. In biomedical imaging, magnetic field correlation was examined for a potential quantitative assessment of iron in brain [12]. It was shown that the magnetic field correlation function is closely related to the structure factor of the pore space [13,14]. Thus it is desirable to devise an experimental method to directly measure the correlation function of the electromagnetic field in such media.In this Letter, we present a NMR method to measure the spatial magnetic correlation function in model porous materials. When a granular sample is placed in a uniform magnetic field, the solid grain and the interstitial material are magnetized differently due to a susceptibility contrast, producing an inhomogeneous magnetic field in the pore space -often called internal field. We use nuclear spins to probe the magnetic field difference between two positions by the following method. First, we employ pulsed field gradient (PFG) NMR to select spins by their translational diffusion displacement. For this experiment, the effect of the internal field is nullified. Then, we perform a similar experiment but with the internal field effect. The field difference between the two positions causes a signal decay that is related to the magnetic field correlation at that displacement. We show that the method is robust for different grain sizes, diffusion, encoding times, and displacement resolution and reliably obtains surface-to-volume ratio (SVR).Conventional translation diffusion measurements ofte...