A 3D water-stable anionic metal–organic framework [Zn4(hpdia)2]·[NH2(CH3)2]·3DMF·4H2O (FJI-C4) was constructed based on an elaborate phosphorus-containing ligand 5,5′-(hydroxyphosphoryl)diisophthalic acid (H5hpdia). FJI-C4 with narrow one-dimensional (1D) pore channels exhibits high selectivity of C3H8/CH4 and C2H2/CH4. It is the first time for the MOF which contains phosphorus for selective separation of methane from natural gas and pyrolysis gas.