The ability of a protein to interact only with a specific set of molecules, and not with other similar but not identical molecules. This specificity is crucial for many biological processes, including enzyme function, ligand binding, and receptor function.