Synthesis of poly(3-aminophenylboronic acid-co-pyrrole) (p(APBA-co-Py)) is carried out potentiodynamically on a pre-passivated mild steel (MS) surface in an oxalic acid solution containing 3-aminophenylboronic acid (APBA) and pyrrole (Py) monomers. The monomer feed ratio was determined using electrochemical impedance spectroscopy (EIS) and adhesion tests. The p(APBA-co-Py) coating is characterized by electrochemically and spectroscopically comparing with poly(3-aminophenylboronic acid) (p(APBA) and polypyrrole (p(Py) homopolymers. SERS, FTIR, XPS, scanning electron microscopy-wavelength dispersive X-ray and- energy dispersive X-ray spectroscopy results indicate the presence of both APBA and Py segments in the p(APBA-co-Py) backbone. The protective properties of the coating are investigated by Tafel and EIS measurements in a 0.50 M HCl solution. The corrosion resistance of p(APBA-co-Py)-coated MS (66.8 omega cm(2)) is higher than that of p(APBA)- and p(Py)-coated, passivated, and uncoated MS. The p(APBA-co-Py) coating embodies the advantageous features of both homopolymers. Py units in p(APBA-co-Py) chains improve the protective property while APBA units carrying the -B(OH)(2) group develop the adhesive property of the layer. EIS results show that the p(APBA-co-Py) coating, due to its homogeneous and compact distribution and the formation of a stable interface, enhanced corrosion resistance of MS by 87.4% for 10 hours in HCl corrosive medium.