A discontinuous Galerkin method of first order is proposed to solve the three-phase flow problem in three-dimensional heterogeneous reservoirs. The formulation is based on the compositional model and the primary unknowns are the total mass fraction of gas, the aqueous phase saturation and the liquid phase pressure. The algorithm is sequential and controls the nonlinearity with a subiteration scheme. Robustness of the method is shown on reservoirs with different heterogeneities: random permeability field, reservoir with barriers and layered reservoir. The algorithm easily handles phase appearance and disappearance, as well as mass transfer between the vapor and liquid phase.