Improving global-scale model representations of near-surface soil moisture and groundwater hydrology is important for accurately simulating terrestrial processes and predicting climate change effects on water resources. Most existing land surface models, including the default E3SM Land Model (ELMv0), which we modify here, routinely employ different formulations for water transport in the vadose and phreatic zones. Clark et al. (2015) identified a variably saturated Richards equation flow model as an important capability for improving simulation of coupled soil moisture and shallow groundwater dynamics. In this work, we developed the Variably Saturated Flow Model (VSFM) in ELMv1 to unify the treatment of soil hydrologic processes in the unsaturated and saturated zones. VSFM was tested on three benchmark problems and results were evaluated against observations and an existing benchmark model (PFLOTRAN). The ELMv1-VSFM's subsurface drainage parameter, fd, was calibrated to match an observationally constrained and spatially explicit global water table depth (WTD) product. Optimal spatially explicit fd values were obtained for 79% of global 1.9° × 2.5° grid cells, while the remaining 21% of global grid cells had predicted WTD deeper than the observationally constrained estimate. Comparison with predictions using the default fd value demonstrated that calibration significantly improved predictions, primarily by allowing much deeper WTDs. Model evaluation using the International Land Model Benchmarking package (ILAMB) showed that improvements in WTD predictions did not degrade model skill for any other metrics. We evaluated the computational performance of the VSFM model and found that the model is about 30% more expensive than the default ELMv0 with an optimal processor layout. The modular software design of VSFM not only provides flexibility to configure the model for a range of problem setups but also allows for building the model independently of the ELM code, thus enabling straightforward testing of the model's physics against other models.