Thermal equilibrium is the condition in which two substances in physical contact with each other exchange no heat energy. Let consider a system requiring a pair of independent co-ordinates X and Y for their complete description. If the values of X and Y remain unchanged so long as the external factors like temperature also remains the same, then the system is said to be in a state of thermal equilibrium.
Two systems A and B having their thermodynamic co-ordinates X and Y and X1 and Y1 respectively separated from each other, for example, by a wall, will have new and common co-ordinates X and Y spontaneously, if the wall is removed. Now the two systems are said to be in thermal equilibrium with each other.