Biologists have long debated the role of behavior in evolution, yet understanding of its role as a driver of adaptation is hampered by the scarcity of experimental studies of natural selection on behavior in nature. After showing that individual Anolis sagrei lizards vary consistently in risk-taking behaviors, we experimentally established populations on eight small islands either with or without Leiocephalus carinatus, a major ground predator. We found that selection predictably favors different risk-taking behaviors under different treatments: Exploratory behavior is favored in the absence of predators, whereas avoidance of the ground is favored in their presence. On predator islands, selection on behavior is stronger than selection on morphology, whereas the opposite holds on islands without predators. Our field experiment demonstrates that selection can shape behavioral traits, paving the way toward adaptation to varying environmental contexts.