Numerous applications of nanoporous materials require their pores to be filled with liquids. In spite of its huge technological importance, the conditions for the wetting of nanometer-sized pores and its phenomenology are still poorly understood. We report on capillary rise experiments with water in carbon xerogels, with synchrotron small-angle scattering used to follow the process in situ at the nanometer scale. The data reveal a two-step wetting process whereby water permeates first into molecular-sized micropores, which is followed by the imbibition of larger mesopores. A Cassie-Baxter analysis shows that the presence of water in the micropores is central, as it turns the mesopores from being hydrophobic to hydrophilic. Based on the so-calculated contact angles, the mesopore wetting kinetics are found to be quantitatively described by a classical Washburn model. Modeling of the experimental water profile ahead of the Washburn front reveals strong surface barriers opposing water transfer from the mesopores to the micropores.