In this paper, two-phase fluid systems are simulated using a diffusive interface model with the Peng-Robinson equation of state (EOS), a widely used realistic EOS for hydrocarbon fluid in the petroleum industry. We first utilize the gradient theory of thermodynamics and variational calculus to derive a generalized chemical equilibrium equation, which is mathematically a second-order elliptic partial differential equation (PDE) in molar density with a strongly nonlinear source term. To solve this PDE, we convert it to a time-dependent parabolic PDE with the main interest in its final steady state solution. A Lagrange multiplier is used to enforce mass conservation. The parabolic PDE is then solved by mixed finite element methods with a semi-implicit time marching scheme. Convex splitting of the energy functional is proposed to construct this time marching scheme, where the volume exclusion effect of an EOS is treated implicitly while the pairwise attraction effect of EOS is calculated explicitly. This scheme is proved to be unconditionally energy stable. Our proposed algorithm is able to solve successfully the spatially heterogeneous two-phase systems with the Peng-Robinson EOS in multiple spatial dimensions, the first time in the literature. Numerical examples are provided with realistic hydrocarbon components to illustrate the theory. Furthermore, our computational results are compared with laboratory experimental data and verified with the Young-Laplace equation with good agreement. This work sets the stage for a broad extension of efficient convex-splitting semi-implicit schemes for numerical simulation of phase field models with a realistic EOS in complex geometries of multiple spatial dimensions.