The relative effects of the elevational gradient and of environmental discontinuities (ecotones) on the structure of a herpetofaunal assemblage in a tropical upland forest were contrasted by means of canonical correspondence analysis. Qualitative descriptors were used to define the elevational positions of the ecotones of interest, namely transitions in forest type and presence/absence of water bodies. The elevational gradient was coded in a form that accommodated different types of community response. Analyses were run for four subsets of the entire assemblage: (1) reptiles, (2) amphibians, (3) amphibians dependent on streams for reproduction, and (4) amphibians that do not use streams for reproduction. All subsets showed a significant relationship with the gradient, which suggested that most species respond to the physical continuum associated with the change in elevation. A response to ecotones was revealed for the amphibian subset only and associated with the presence or absence of watercourses. However, this response disappeared within subsets 3 and 4. A variation partitioning analysis was used to assess the individual and common contributions of gradient and ecotone descriptors to the elevational variation in the structure of subsets 1 and 2. The gradient descriptors explained more variation in the reptile subset than did ecotones, while the reverse was found in the amphibian subset. The dependence of most amphibians on aquatic breeding sites that were not available at all elevations reduced the relative importance of the gradient on the species distributions in subset 2 and accounted for the difference to the reptiles. In all, these findings add to the results of previous null model tests on the same four subsets, where competitive interactions were assigned a minor importance in limiting elevational distributions. The response patterns revealed by the present approach, with ecotones and gradient contrasted in a single analysis, emphasised the role of individual responses to the gradient according to the species' physiological tolerance limits.