Multiphase flows in porous media are of critical importance in a number of areas such as phase separation in engineering devices (e.g., coalescers) and CO2 sequestration. Common challenges in these applications include – among others – the characterization of contact line motion within complex geometries and the physical discontinuities at the fluid-fluid interface and fluid-solid interface. Engineering models for two-phase flows within porous materials often rely on postulated relations based on Darcy’s law, instead of being built from phase-averaging exact equations for mass and momentum, along with first-principle closure models. In this work, we propose a computationally efficient methodology for simulating two-phase flows within complex geometries, which relies on an immersed boundary approach and on a conservative level set technique modified to account for contact line dynamics. This method is shown to be mass-conserving and accurate even at limited resolution. Then we use this newly developed computational approach to explore the physics of a single droplet interacting with a single rigid fiber, and two-phase flow displacement in porous media.