Because they may provide ultrathin, high-flux, and energy-efficient membranes for precise ionic and molecular sieving in aqueous solution, GO membranes (partially oxidized, stacked sheets of graphene) have shown great potential in water desalination and purification, gas and ion separation, biosensors, proton conductors, lithium-based batteries and super-capacitors. Unlike carbon nanotube (CNT) membranes, in which the nanotube pores have fixed sizes, the pores of GO membranes - the interlayer spacing between GO sheets - are of variable size. This presents a challenge for using GO membranes for filtration. Despite the great efforts to tune and fix the interlayer spacing, it remains difficult both to reduce the interlayer spacing sufficiently to exclude small ions while keeping this separation constant against the tendency of GO membranes to swell when immersed in aqueous solution, which greatly affects the applications of GO membranes. Here, we demonstrate experimentally that highly efficient and selective ion rejection by GO membranes can be readily achieved by controlling the interlayer spacing of GO membranes using cations (K+, Na+, Ca2+, Li+ and Mg2+) themselves. The interspacing can be controlled with precision as small as 1 A, and GO membranes controlled by one kind of cation can exclude other cations with a larger hydrated volume, which can only be accommodated with a larger interlayer spacing. First-principles calculations reveal that the strong noncovalent cation-pi interactions between hydrated cations in solution and aromatic ring structures in GO are the cause of this unexpected behavior. These findings open up new avenues for using GO membranes for water desalination and purification, lithium-based batteries and super-capacitors, molecular sieves for separating ions or molecules, and many other applications.