Oil/water separation membranes with superior anti-fouling properties against highly viscous oils are crucial for the efficient treatment of oily wastewater. Herein, the effects of functional groups in an inorganic superhydrophilic membrane on the anti-fouling properties of the membrane are investigated. Using a facile one-step electrochemical deposition method, Ni1-xCoxHPO4·3H2O membranes were formed on a Cu(OH)2 microneedle-coated copper mesh (CCNC–P) with superhydrophilic and underwater superoleophobic properties. All CCNC–P membranes with different Co2+ contents showed outstanding anti-fouling capability for oily wastewater such as those containing crude oil. The CCNC–P(x = 0.5) membrane exhibited high separation efficiency reaching 99.7 % across five oil–water mixtures and oil-in-water emulsions, concurrently presenting an ultrahigh flux of 61695 L m−2 h−1 for crude oil–water mixture. Moreover, the membrane consistently maintained its separation performance during the long-term crude oil–water separation process. The flux decline ratio was below 1 %, and the flux recovery ratio approached 99.4 %. The CCNC–P membranes possessed superior chemical, thermal, and mechanical stability, suggesting significant potential for the industrial treatment of oily wastewater. Density functional theory calculation revealed that the HPO42− group in CCNC–P can strongly adsorb water molecules. The resultant stabilized hydration layer impeded the contact between the membrane surface and oil droplets, while the metal ions scarcely influenced the adsorption of water molecules on CCNC–P. These findings provide new insights into the development of novel oil–water separation membranes with higher anti-fouling capabilities against high-viscosity oils.