Tourmaline is commonly an accessory, locally abundant, mineral in granite-related hydrothermal Sn deposits and records information about the nature and evolution of mineralizing fluids and ore-forming processes. The world-class San Rafael lode-type Sn deposit, located in the northern part of the Andean Tin Belt in southern Peru, is characterized by volumetrically important tourmaline alteration, which resulted from massive fluid-rock interaction. Based on their paragenetic position, several generations of tourmaline have been identified in the San Rafael deposit both of magmatic and hydrothermal origin. They correspond to three major episodes of tourmaline formation that were characterized texturally and compositionally (major and trace elements, and oxygen isotopic signatures) by in situ analysis (SEM, EPMA, LA-ICP-MS, SIMS). The first one, magmatic tourmaline, is found in peraluminous granites. It is texturally homogeneous, has dravite composition with high Li, K, Na, and Zn contents, and shows a narrow range of δ18O values (10.4-11.6 ‰). The second episode corresponds to hydrothermal tourmaline formed during post-magmatic subsolidus alteration and veining-brecciation. It shows complex textural features at microscopical scale, and ranges in composition from dravite to schorl, with similar trace element and δ18O signatures (10.4-14.1 ‰) as the magmatic tourmalines. The last episode formed tourmaline with a schorl-foitite composition, high Sr, Be, Cr, Ni, and HREE contents, and lower δ18O values (7.1-9.7 ‰). It precedes the main quartz-cassiterite-chlorite ore stage and shows particularly high Sn contents (up to 1'000 ppm). Tourmaline formation at San Rafael results thus from multiple fluid circulation episodes in a protracted magmatic-hydrothermal system. Oxygen isotope data indicate precipitation from magmatic-dominated fluid, as recorded previously also for the main ore stage at San Rafael.