Carbonatites of the Jacupiranga alkaline–carbonatite complex in São Paulo State, Brazil, were used to investigate mineral–fluid interaction in a carbonatite magma chamber because apatite showed a marked discontinuity between primary fluid inclusion-rich cores and fluid inclusion-poor rims. Sylvite and burbankite, apatite, pyrite, chalcopyrite and ilmenite are the common phases occurring as trapped solids within primary fluid inclusions and reflect the general assemblage of the carbonatite. The apatite cores had higher Sr and REE concentrations than apatite rims, due to the presence of fluid inclusions into which these elements partitioned. A positive cerium anomaly was observed in both the core and rim of apatite crystals because oxidised Ce 4+ partitioned into the magma. The combined evidence from apatite chemistry, fluid inclusion distribution and fluid composition was used to test the hypotheses that the limit of fluid inclusion occurrence within apatite crystals arises from: (1) generation of a separate fluid phase; (2) utilization of all available fluid during the first stage of crystallization; (3) removal of crystals from fluid-rich magma to fluid-poor magma; (4) an increase in the growth rate of apatite; or (5) escape of the fluids from the rim of the apatite after crystallization. The findings are consistent with fractionation and crystal settling of a carbonatite assemblage in a fluid-stratified magma chamber. Secondary fluid inclusions were trapped during a hydrothermal event that precipitated an assemblage of anhedral crystals: strontianite, carbocernaite, barytocalcite, barite and norsethite, pyrophanite, magnesian siderite and baddeleyite, ancylite-(Ce), monazite-(Ce) and allanite. The Sr- and REE-rich nature of the secondary assemblage, and lack of a positive cerium anomaly indicate that hydrothermal fluids have a similar source to the primary magma and are related to a later carbonatite intrusion.