Facile yet rational design of efficient electrocatalyst toward triiodide reduction reaction is a persistent challenge for the practical application of dye-sensitized solar cell (DSSC). Here we propose a protocol for fabricating atomic N-coordinated cobalt sites (Co-Nx-C) within nanomesh graphene frameworks (Co-NMG). The as-synthesized Co-NMG combines the features of atomically dispersed active sites and interconnected mesoporous structure with high porosity, which makes these active sites fully exposed and accessible while facilitating the mass transport of reactants. As a result, the Co-NMG electrocatalysts with substantial active sites and desired porous architectures exhibit high electrocatalytic activity and long-term electrochemical stability. Electrochemical measurements and DFT calculations reveal that the catalytic sites toward the reduction of triiodide mainly derive from the abundant topological defects, nitrogen dopants, and especially the atomic Co-Nx-C moieties. Furthermore, with Co-NMG as counter electrodes (CEs), the DSSCs display a power conversion efficiency of 9.06%, which is higher than that of Pt CEs (7.71%). This work not only provides a promising CE material for DSSC to address the issues associated with Pt catalyst, but also opens up new avenues for developing nanocarbon based catalysts with desired features for other energy-related applications.