Given a quasi-lattice ordered group (G, P ) and a compactly aligned product system X of essential C * -correspondences over the monoid P , we show that there is a bijection between the gauge-invariant KMS β -states on the Nica-Toeplitz algebra N T (X) of X with respect to a gauge-type dynamics, on one side, and the tracial states on the coefficient algebra A satisfying a system (in general infinite) of inequalities, on the other. This strengthens and generalizes a number of results in the literature in several directions: we do not make any extra assumptions on P and X, and our result can, in principle, be used to study KMS-states at any finite inverse temperature β. Under fairly general additional assumptions we show that there is a critical inverse temperature βc such that for β > βc all KMS β -states are of Gibbs type, hence gauge-invariant, in which case we have a complete classification of KMS β -states in terms of tracial states on A, while at β = βc we have a phase transition manifesting itself in the appearance of KMS β -states that are not of Gibbs type. In the case of right-angled Artin monoids we show also that our system of inequalities for traces on A can be reduced to a much smaller system, a finite one when the monoid is finitely generated. Most of our results generalize to arbitrary quasi-free dynamics on N T (X).Acknowledgement. This research was initiated when Z.A. visited the Department of Mathematics at the University of Oslo. She thanks her colleagues for their hospitality.