The present invention provides a surface treatment agent for a metallic material, the agent forming a coating having superior post-processing adhesion, post-processing corrosion resistance, and bare corrosion resistance, and enabling favorable post-processing adhesion and corrosion resistance with a film formed on the coating. This surface treatment agent for a metallic material is a product (X) obtained by at least reacting a compound having two or more hydroxyphenyl groups in the molecule with epichlorohydrin, the product (X) containing (A) a polymer formed by polymerizing a carboxyl-group-containing vinyl monomer, (B) at least one compound selected from the group consisting of a Zr compound and a Ti compound, and (C) a silicon compound, the mass ratio of the amount of polymer (A) with respect to the total amount of the polymer (A), the compound (B) and the silicon compound (C) ((A)/((A)+(B)+(C))x100) being within the range of 10 to 70% (mass), the hydroxyl value of the polymer (A) being 10 to 400 mgKOH, an