Porous sediments and rocks in the subsurface are crucial to mitigate carbon emissions and manage water resources: their pores can store greenhouse gases, renewable energy and groundwater. However, there are key gaps in our understanding of the fluid dynamics in the intricate network of pores in these materials. First, when a single fluid flows through the pores, pore-scale velocity variations have a complex impact on the spreading of solutes. Second, models of how colloids (e.g. pathogens) travel with these flows are ill-constrained. Finally, when two fluids compete for space, the dynamics of the resulting capillary driven fluid movements are poorly understood. A crucial obstacle to this has been a lack of direct measurements of pore-scale flows in rocks and sediments. Here, I will develop groundbreaking new techniques to measure 3D flow fields at the micrometer scale, by tracking microscopic tracer particles suspended in the flow with X-ray imaging. 4D X-ray micro-computed tomography at high resolutions in space and time will be combined with concepts from correlation-based image velocimetry and Langrangian particle tracking. Flow fields measured in geological samples will then be used to make great strides forward in the key research questions above, impacting field scale geological reservoir and aquifer modelling. This innovative methodology can also be a game changer for a host of scientific and industrial applications of porous materials.