Disclosed herein is a method and system for separating carbon dioxide (CO2) from a CO2 containing gas stream containing water vapor and additional impurities, for example, nitrogen, oxygen, sulfur oxides, nitrogen oxides, and mercury. The CO2 is captured by subjecting the CO2 gas feed stream to a temperature swing adsorption step. The temperature swing adsorption step comprises an adsorption step for producing a substantially dry carbon dioxide-depleted stream, and an adsorbent regeneration step comprising heating the adsorbent bed to produce a substantially water vapor-free carbon dioxide stream. Moisture from the gas stream containing CO2 is optionally removed by pressure swing adsorption, temperature swing adsorption, membrane separation, or absorption prior to CO2 capture.