The aim of this paper is to introduce n-ary Hom-algebra structures generalizing the n-ary algebras of Lie type including n-ary Nambu algebras, n-ary Nambu-Lie algebras and n-ary Lie algebras, and n-ary algebras of associative type including n-ary totally associative and n-ary partially associative algebras. We provide examples of the new structures and present some properties and construction theorems. We describe the general method allowing one to obtain an n-ary Hom-algebra structure starting from an n-ary algebra and an n-ary algebra endomorphism. Several examples are derived using this process. Also we initiate investigation of classification problems for algebraic structures introduced in the article and describe all ternary three-dimensional Hom-Nambu-Lie structures with diagonal homomorphism.