A treaty is an express agreement under international law
International law
Public international law concerns the structure and conduct of sovereign states; analogous entities, such as the Holy See; and intergovernmental organizations. To a lesser degree, international law also may affect multinational corporations and individuals, an impact increasingly evolving beyond...

 entered into by actors in international law, namely sovereign state
Sovereign state
A sovereign state, or simply, state, is a state with a defined territory on which it exercises internal and external sovereignty, a permanent population, a government, and the capacity to enter into relations with other sovereign states. It is also normally understood to be a state which is neither...

s and international organizations. A treaty may also be known as an (international) agreement, protocol, covenant, convention or exchange of letters, among other terms. Regardless of terminology, all of these forms of agreements are, under international law, equally considered treaties and the rules are the same.

Treaties can be loosely compared to contract
A contract is an agreement entered into by two parties or more with the intention of creating a legal obligation, which may have elements in writing. Contracts can be made orally. The remedy for breach of contract can be "damages" or compensation of money. In equity, the remedy can be specific...

s: both are means of willing parties assuming obligations among themselves, and a party to either that fails to live up to their obligations can be held liable under international law.
A treaty is an official, express written agreement that states use to legally bind themselves.