Abstract Environmental gradients act as potent filters on species distributions driving compositional shifts across communities. Compositional shifts may reflect differences in physiological tolerances to a limiting resource that result in broad distributions for tolerant species and restricted distributions for intolerant species (i.e. a nested pattern). Alternatively, trade‐offs in resource use or conflicting species' responses to multiple resources can result in complete turnover of species along gradients. We combined trait (leaf area, leaf mass per area, wood density and maximum height) and distribution data for 550 tree species to examine taxonomic and functional composition at 72 sites across strong gradients of soil phosphorus (P) and rainfall in central Panama. We determined whether functional and taxonomic composition was nested or turned over completely and whether community mean traits and species composition were more strongly driven by P or moisture. Turnover characterized the functional composition of tree communities. Leaf traits responded to both gradients, with species having larger and thinner leaves in drier and more fertile sites than in wetter and less fertile sites. These leaf trait–moisture relationships contradict predictions based on drought responses and suggest a greater role for differences in light availability than in moisture. Shifts in wood density and maximum height were weaker than for leaf traits with taller species dominating wet sites and low wood density species dominating P‐rich sites. Turnover characterized the taxonomic composition of tree communities. Geographic distances explained a larger fraction of variation for taxonomic composition than for functional composition, and community mean traits were more strongly driven by P than moisture. Synthesis. Our results offer weak support for the tolerance hypothesis for tree communities in central Panama. Instead, we observe functional and taxonomic turnover reflecting trade‐offs and conflicting species' responses to multiple abiotic factors including moisture, soil phosphorus and potentially other correlated variables (e.g. light).