Developing adhesives that can function underwater remains a major challenge for bioengineering, yet many marine creatures, exemplified as mussels and barnacles, have evolved their unique proteinaceous adhesives for strong wet adhesion. The mechanisms underlying the strong adhesion of these natural adhesive proteins provide rich information for biomimetic efforts. Here, combining atomic force microscopy (AFM) imaging and force spectroscopy, we examine the effects of pH on the self-assembly and adhesive properties of cp19k, a key barnacle underwater adhesive protein. For the first time, we confirm that the bacterial recombinant Balanus albicostatus cp19k (rBalcp19k), which contains no 3,4-dihydroxyphenylalanine (DOPA) or any other amino acids with post-translational modifications, can self-assemble into aggregated nanofibers at acidic pHs. Under moderately acidic conditions, the adhesion strength of unassembled monomeric rBalcp19k on mica is only slightly lower than that of a commercially available mussel adhesive protein mixture, yet the adhesion ability of rBalcp19k monomers decreases significantly at increased pH. In contrast, upon preassembly at acidic and low-salinity conditions, rBalcp19k nanofibers keep stable in basic and high-salinity seawater and display much stronger adhesion and thus show resistance to its adverse impacts. Besides, we find that the adhesion ability of Balcp19k is not impaired when it is combined with an N-terminal Thioredoxin (Trx) tag, yet whether the self-assembly property will be disrupted is not determined. Collectively, the self-assembly-enhanced adhesion presents a previously unexplored mechanism for the strong wet adhesion of barnacle cement proteins and may lead to the design of barnacle-inspired adhesive materials.