The world-class San Rafael tin (-copper) deposit (central Andean tin belt, southeast Peru) is an exceptionally large and rich (>1 million metric tons Sn; grades typically >2% Sn) cassiterite-bearing hydrothermal vein system hosted by a late Oligocene (ca. 24 Ma) peraluminous K-feldspar-megacrystic granitic complex and surrounding Ordovician shales affected by deformation and low-grade metamorphism. The mineralization consists of NW-trending, quartz-cassiterite-sulfide veins and fault-controlled breccia bodies (>1.4 km in vertical and horizontal extension). They show volumetrically important tourmaline alteration that principally formed prior to the main ore stage, similar to other granite-related Sn deposits worldwide. We present here a detailed textural and geochemical study of tourmaline, aiming to trace fluid evolution of the San Rafael magmatic-hydrothermal system that led to the deposition of tin mineralization. Based on previous works and new petrographic observations, three main generations of tourmaline of both magmatic and hydrothermal origin were distinguished and were analyzed in situ for their major, minor, and trace element composition by electron microprobe analyzer and laser ablation-inductively coupled plasma-mass spectrometry, as well as for their bulk Sr, Nd, and Pb isotope compositions by multicollector-inductively coupled plasma-mass spectrometry. A first late-magmatic tourmaline generation (Tur 1) occurs in peraluminous granitic rocks as nodules and disseminations, which do not show evidence of alteration. This early Tur 1 is texturally and compositionally homogeneous; it has a dravitic composition, with Fe/(Fe + Mg) = 0.36 to 0.52, close to the schorl-dravite limit, and relatively high contents (10s to 100s ppm) of Li, K, Mn, light rare earth elements, and Zn. The second generation (Tur 2)—the most important volumetrically—is pre-ore, high-temperature (>500°C), hydrothermal tourmaline occurring as phenocryst replacement (Tur 2a) and open-space fillings in veins and breccias (Tur 2b) and microbreccias (Tur 2c) emplaced in the host granites and shales. Pre-ore Tur 2 typically shows oscillatory zoning, possibly reflecting rapid changes in the hydrothermal system, and has a large compositional range that spans the schorl to dravite fields, with Fe/(Fe + Mg) = 0.02 to 0.83. Trace element contents of Tur 2 are similar to those of Tur 1. Compositional variations within Tur 2 may be explained by the different degree of interaction of the magmatic-hydrothermal fluid with the host rocks (granites and shales), in part because of the effect of replacement versus open-space filling. The third generation is syn-ore hydrothermal tourmaline (Tur 3). It forms microscopic veinlets and overgrowths, partly cutting previous tourmaline generations, and is locally intergrown with cassiterite, chlorite, quartz, and minor pyrrhotite and arsenopyrite from the main ore assemblage. Syn-ore Tur 3 has schorl-foititic compositions, with Fe/(Fe + Mg) = 0.48 to 0.94, that partly differ from those of late-magmatic Tur 1 and pre-ore hydrothermal Tur 2. Relative to Tur 1 and Tur 2, syn-ore Tur 3 has higher contents of Sr and heavy rare earth elements (10s to 100s ppm) and unusually high contents of Sn (up to >1,000 ppm). Existence of these three main tourmaline generations, each having specific textural and compositional characteristics, reflects a boron-rich protracted magmatic-hydrothermal system with repeated episodes of hydrofracturing and fluid-assisted reopening, generating veins and breccias. Most trace elements in the San Rafael tourmaline do not correlate with Fe/(Fe + Mg) ratios, suggesting that their incorporation was likely controlled by the melt/fluid composition and local fluid-rock interactions. The initial radiogenic Sr and Nd isotope compositions of the three aforementioned tourmaline generations (0.7160–0.7276 for 87Sr/86Sr(i) and 0.5119–0.5124 for 143Nd/144Nd(i)) mostly overlap those of the San Rafael granites (87Sr/86Sr(i) = 0.7131–0.7202 and 143Nd/144Nd(i) = 0.5121–0.5122) and support a dominantly magmatic origin of the hydrothermal fluids. These compositions also overlap the initial Nd isotope values of Bolivian tin porphyries. The initial Pb isotope compositions of tourmaline show larger variations, with 206Pb/204Pb(i), 207Pb/204Pb(i), and 208Pb/204Pb(i) ratios mostly falling in the range of 18.6 to 19.3, 15.6 to 16.0, and 38.6 to 39.7, respectively. These compositions partly overlap the initial Pb isotope values of the San Rafael granites (206Pb/204Pb(i) = 18.6–18.8, 207Pb/204Pb(i) = 15.6–15.7, and 208Pb/204Pb(i) = 38.9–39.0) and are also similar to those of other Oligocene to Miocene Sn-W ± Cu-Zn-Pb-Ag deposits in southeast Peru. Rare earth element patterns of tourmaline are characterized, from Tur 1 to Tur 3, by decreasing (Eu/Eu*)N ratios (from 20 to 2) that correlate with increasing Sn contents (from 10s to >1,000 ppm). These variations are interpreted to reflect evolution of the hydrothermal system from reducing toward relatively more oxidizing conditions, still in a low-sulfidation environment, as indicated by the pyrrhotite-arsenopyrite assemblage. The changing textural and compositional features of Tur 1 to Tur 3 reflect the evolution of the San Rafael magmatic-hydrothermal system and support the model of fluid mixing between reduced, Sn-rich magmatic fluids and cooler, oxidizing meteoric waters as the main process that caused cassiterite precipitation.