We study the problem of nonparametric estimation of a multivariate function g: ℝd→ℝ that can be represented as a composition of two unknown smooth functions f: ℝ→ℝ and G: ℝd→ℝ. We suppose that f and G belong to known smoothness classes of functions, with smoothness γ and β, respectively. We obtain the full description of minimax rates of estimation of g in terms of γ and β, and propose rate-optimal estimators for the sup-norm loss. For the construction of such estimators, we first prove an approximation result for composite functions that may have an independent interest, and then a result on adaptation to the local structure. Interestingly, the construction of rate-optimal estimators for composite functions (with given, fixed smoothness) needs adaptation, but not in the traditional sense: it is now adaptation to the local structure. We prove that composition models generate only two types of local structures: the local single-index model and the local model with roughness isolated to a single dimension (i.e., a model containing elements of both additive and single-index structure). We also find the zones of (γ, β) where no local structure is generated, as well as the zones where the composition modeling leads to faster rates, as compared to the classical nonparametric rates that depend only to the overall smoothness of g.