Two languages are considered to be genetically related if one is descended from the other or if both are descended from a common ancestor. For example, Italian is descended from Latin. Italian and Latin are therefore said to be genetically related. Spanish is also descended from Latin. Therefore, Spanish and Italian are genetically related.
Contact with another language can result in influence by it. For example, English has been influenced by French, Persian has been influenced by Arabic, and Japanese has been influenced by Chinese. However, this influence by definition does not constitute a genetic relationship.
The discipline of historical linguistics rests on the theory that almost all of the languages spoken in the world today can be grouped by derivation from common ancestral languages into a relatively small number of families. For example, English is related to other Indo-European languages and more specifically to the Germanic family (West Germanic branch), while Mandarin Chinese is related to many other Sino-Tibetan languages.