Physisorption presents as a promising energy-saving technique for carbon dioxide (CO2) sequestration, which is crucial for processing various industrially important gases (e.g. natural gas and flue gas). However, to target desirable porous materials that simultaneously combine high CO2 selectivity and moderate adsorption enthalpy especially under humid and wide-temperature environment is challenging. Herein, we report the capture of CO2 from humid gas with a novel ultramicroporous metal–organic framework ZU-301 that features one-dimensional robust pore channel decorated by high-density oxalate anions and hydrophobic methyls. The rigid framework coupled with fine-tuned aperture size permits CO2 trapping while sets a barrier for CH4, leading to excellent separation selectivity (90–111) in a wide temperature range (298–323 K). The introduced oxalate anions and methyls synergistically grasp CO2via mild interactions, giving rise to moderate adsorption enthalpy (38 kJ mol−1), as evidenced by single-crystal X-ray diffraction analysis performed on CO2-loaded ZU-301, meanwhile render ZU-301 low affinity to moisture with the CO2/H2O uptake ratio outperforming many benchmark materials. Additionally, ZU-301 exhibits good chemical stability, which even can be soaked in strong acid or base solutions (pH = 2–12) without losing CO2 capture ability. Breakthrough experiments confirmed the high efficiency of ZU-301 for CO2/CH4 and CO2/N2 separation under elevated temperature and humid conditions, which is of important scientific and industrial value.