A microporous, moisture-stable, and amine-functionalized metal-organic framework for highly selective separation of CO2 from CH4.