Or as the Gibbs free energy, i.e. systems at constant pressure and temperature:
The process that leads to a thermodynamic equilibrium is called thermalization. An example of this is a system of interacting particles that is left undisturbed by outside influences. By interacting, they will share energy/momentum among themselves and reach a state where the global statistics are unchanging in time.
Thermal equilibrium is achieved when two systems in thermal contact with each other cease to exchange energy by heat. If two systems are in thermal equilibrium their temperatures are the same.
Thermodynamics deals with equilibrium states. The word equilibrium implies a state of balance. In an equilibrium state, there are no unbalanced potentials (or driving forces) with the system. A system that is in equilibrium experiences no changes when it is isolated from its surroundings.
The opposite of equilibrium systems are nonequilibrium systems that are instantaneously off balance.
These relationships can be derived by considering the differential form of thermodynamic potentials.
It is useful to distinguish between global and local thermodynamic equilibrium. In thermodynamics, exchanges within a system and between the system and the outside are controlled by intensive parameters. As an example, temperature controls heat exchanges. Global thermodynamic equilibrium (GTE) means that those intensive parameters are homogeneous throughout the whole system, while local thermodynamic equilibrium (LTE) means that those intensive parameters are varying in space and time, but are varying so slowly that for any point, one can assume thermodynamic equilibrium in some neighborhood about that point.
If the description of the system requires variations in the intensive parameters that are too large, the very assumptions upon which the definitions of these intensive parameters are based will break down, and the system will be in neither global nor local equilibrium. For example, it takes a certain number of collisions for a particle to equilibrate to its surroundings. If the average distance it has moved during these collisions removes it from the neighborhood it is equilibrating to, it will never equilibrate, and there will be no LTE. Temperature is, by definition, proportional to the average internal energy of an equilibrated neighborhood. Since there is no equilibrated neighborhood, the very concept of temperature breaks down, and the temperature becomes undefined.
It is important to note that this local equilibrium applies only to massive particles. In a radiating gas, the photons being emitted and absorbed by the gas need not be in thermodynamic equilibrium with each other or with the massive particles of the gas in order for LTE to exist.
As an example, LTE will exist in a glass of water which contains a melting ice cube. The temperature inside the glass can be defined at any point, but it is colder near the ice cube than far away from it. If energies of the molecules located near a given point are observed, they will be distributed according to the Maxwell-Boltzmann distribution for a certain temperature. If the energies of the molecules located near another point are observed, they will be distributed according to the Maxwell-Boltzmann distribution for another temperature.
Local thermodynamic equilibrium is not a stable state, unless it is maintained by exchanges between the system and the outside. For example, it could be maintained inside the glass of water by regularly adding ice into it in order to compensate for the melting. Transport phenomena are processes which lead a system from local to global thermodynamic equilibrium. Going back to our example, the diffusion of heat will lead our glass of water toward global thermodynamic equilibrium, a state in which the temperature of the glass is completely homogeneous.