Developing low-cost electrocatalysts to replace precious Ir-based materials is key for oxygen evolution reaction (OER). Here, we report atomically dispersed nickel coordinated with nitrogen and sulfur species in porous carbon nanosheets as an electrocatalyst exhibiting excellent activity and durability for OER with a low overpotential of 1.51 V at 10 mA cm-2 and a small Tafel slope of 45 mV dec-1 in alkaline media. Such electrocatalyst represents the best among all reported transition metal- and/or heteroatom-doped carbon electrocatalysts and is even superior to benchmark Ir/C. Theoretical and experimental results demonstrate that the well-dispersed molecular S|NiNx species act as active sites for catalyzing OER. The atomic structure of S|NiNx centers in the carbon matrix is clearly disclosed by aberration-corrected scanning transmission electron microscopy and synchrotron radiation X-ray absorption spectroscopy together with computational simulations. An integrated photoanode of nanocarbon on a Fe2O3 nanosheet array enables highly active solar-driven oxygen production.