Using a numerical technique, known as the lattice-Boltzmann method, we study immiscible three-phase flow at the pore scale. An important phenomenon at this scale is the spreading of oil onto the gas-water interface. In this paper, we recognize from first principles how injected gas remobilizes initially trapped oil blobs. The two main flow mechanisms which account for this type of remobilization are simulated. These are the double-drainage mechanism and (countercurrent) film flow of oil. The simulations agree qualitatively with experimental findings in the literature. We also simulate steady-state three-phase flow (fixed and equal saturations) in a small segment of a waterwet porous medium under both spreading and nonspreading conditions. The difference between the two conditions with respect to the coefficients in the generalized law of Darcy (which also includes viscous coupling) is investigated.