This paper addresses the problem of finding the number, K, of phases present at equilibrium and their composition, in a chemical mixture of ns substances. This corresponds to the global minimum of the Gibbs free energy of the system, subject to constraints representing mb independent conserved quantities, where mb=ns when no reaction is possible and mb ≤ ne +1 when reaction is possible and ne is the number of elements present. After surveying previous work in the field and pointing out the main issues, we extend the necessary and sufficient condition for global optimality based on the ‘reaction tangent-plane criterion’, to the case involving different thermodynamical models (multiple phase classes). We then present an algorithmic approach that reduces this global optimization problem (involving a search space of mb(ns-1) dimensions) to a finite sequence of local optimization steps inK(ns-1) -space, K ≤ mb, and global optimization steps in (ns-1)-space. The global step uses the tangent-plane criterion to determine whether the current solution is optimal, and, if it is not, it finds an improved feasible solution either with the same number of phases or with one added phase. The global step also determines what class of phase (e.g. liquid or vapour) is to be added, if any phase is to be added. Given a local minimization procedure returning a Kuhn–Tucker point and a global optimization procedure (for a lower-dimensional search space) returning a global minimum, the algorithm is proved to converge to a global minimum in a finite number of the above local and global steps. The theory is supported by encouraging computational results.