Commercial compositional simulators commonly apply correlations or empirical relations based on tuned experimental data to calculate phase relative permeabilities. These relations cannot adequately capture effects of hysteresis, fluid compositional variations and rock wettability alteration. Furthermore, these relations require phases to be labeled, which is not accurate for complex miscible or near miscible displacements with multiple hydrocarbon phases. Therefore, these relations can be discontinuous for miscible and near-miscible displacements causing inaccuracies and numerical problems in simulation. This paper develops an equation-of-state (EoS) to model robustly and continuously the relative permeability as functions of phase saturations and distributions, fluid compositions, rock surface properties, and rock structure. Phases are not labelled; instead, the phases in each grid block are ordered based on their compositional similarity. Phase compositions and rock surface properties are used to calculate wettability and contact angles. The model is tuned to measured two-phase relative permeability curves with few tuning parameters and then used to predict relative permeability away from the measured experimental data. The model is applicable to all flow in porous media processes, but is especially important for low salinity polymer, surfactant, miscible gas and water-alternating-gas flooding. The results show excellent ability to match measured data, and to predict observed trends in hysteresis and oil saturation trapping including those from Land's model and for a wide range in wettability. The results also show that relative permeabilities are continuous at critical points and yields a physically correct numerical solution when incorporated within a compositional simulator (PennSim). The model has very few tuning parameters, and the parameters are directly related to physical properties of rock and fluid, which can be measured. The new model also offers the potential for incorporating results from CT-scans and pore-network models to determine some input parameters for the new EoS.