Novel polyaniline (PANI) nanofiber counter electrodes (CEs) modified with different transition metal ions were synthesized and showed remarkable catalytic activity for dye‐sensitized solar cells (DSSCs). The PANI nanofiber–transition metal ion electrodes were characterized by using Fourier transform infrared spectroscopy, scanning electron microscopy, current density–voltage curves, energy‐dispersive X‐ray spectroscopy, cyclic voltammetry, electrochemical impedance spectroscopy, and Tafel polarization plots. The PANI CEs modified with Ni2+ and Co2+ exhibited low charge‐transfer and series resistances, which indicate high electrocatalytic activity toward the iodide redox shuttle. In contrast, the PANI CE modified with Mn2+ did not show much difference in its catalytic behavior, whereas the PANI—Cu2+ CE showed reduced electrochemical performance. The photovoltaic performances of the DSSCs based on the PANI–Ni2+ and PANI–Co2+ CEs were evaluated and they were found to exhibit power conversion efficiency of 4.70 and 4.57 %, higher than that of the pristine PANI‐CE‐based device (3.87 %). These easily fabricated PANI–metal composites with improved electrochemical activities are promising CEs for DSSCs to replace expensive Pt.