While climatic extremes are predicted to increase with global warming, we know little about the effect of climatic variability on biome distribution. Here, we show that rainy El Niño Southern Oscillation (ENSO) events can enhance tree recruitment in the arid and semiarid ecosystems of north-central Chile and northwest Peru. Tree-ring studies in natural populations revealed that rainy El Niño episodes have triggered forest regeneration in Peru. Field experiments indicate that tree seedling recruitment in Chile is much less successful than in Peru due mostly to larger mortality caused by herbivores. The dramatic impact of herbivores in Chile was derived from the combined result of slower plant growth and the presence of exotic herbivores (European rabbits and hares). The interplay of herbivory and climatic effects we demonstrated implies that rainy ENSO events may represent ‘windows of opportunity’ for forest recovery if herbivore pressure is minimized at the right moment.