Salinity-gradient directed osmotic energy between seawater and river water has been widely considered as a promising clean and renewable energy source, as there are numerous river estuaries on our planet. In the past few decades, reverse electrodialysis (RED) technique based on cation-selective membranes has been used as the key strategy to convert osmotic energy into electricity. From this aspect, developing high-efficiency anion-selective membranes will also have great potential for capturing osmotic energy, however, remains systematically unexplored. In nature, electric eels can produce electricity from ionic gradients by using their “sub-nanoscale” protein ion channels to transport ions selectively. Inspired by this, here we developed a UiO-66-NH2 metal-organic framework (MOF) based anion-selective composite membrane with sub-nanochannels, and achieved high-performance salinity-gradient power generation by mixing artificial seawater (0.5 M NaCl) and river water (0.01 M NaCl). The UiO-66-NH2 metal-organic framework based composite membranes can be easily and economically fabricated with dense structure and long-term working stability in saline, and its performance of power generation can also be adjusted by pH to enhance the surface charge density of the MOF sub-nanochannels. This study will inspire the exploitation of MOFs for investigating the sub-nanochannel directed high-performance salinity-gradient energy harvesting systems based on anion-selective ion transport.