One of the legal meanings of tratado is fairly well known. All learners of Spanish seem to know that tratado means "treaty." And indeed it does. Thus, for example, a tratado de doble imposición is a "double taxation treaty (DTT)." In this context it can also be translated as "agreement." A tratado de libre comercio is a "free trade agreement (FTA)."
Less commonly known is the fact that tratado also means "treatise," as in tratado de derecho procesal civil, a "treatise on civil procedure." Other common examples include tratado de derecho civil (treatise on civil law), tratado de derecho penal (treatise on criminal law), tratado de derecho administrativo (treatise on administrative law), etc. Sometimes the preposition sobre is also used in Spanish: tratado sobre derecho penal (another way of saying "treatise on criminal law"). These treatises are extremely important in civil law countries, as they are written by legal scholars and constitute a source of law known as doctrina. Doctrina can be translated in this context as "legal scholarship," "the legal literature," "academic opinion" or "the writings of legal scholars." Some scholars have noted that whereas the common law is essentially "judge-made law" (which is called jurisprudencia in Spanish), the civil law is essentially "scholar-made law" (which is the doctrina that we have been talking about). In other words, when a court in a common law country decides a case, it will first look to the precedents (jurisprudencia) set by courts that have interpreted the law, while a court in a civil law country will first look to the legal scholarship (doctrina) contained in treatises (tratados) interpreting the law.
Note, by the way, that "jurisprudence" in English does not usually refer to "judge-made law" or "case law" or "precedents" but instead to "legal philosophy." The Spanish translation of "jurisprudence" is filosofía del derecho.