Gram-positive pathogens such as staphylococci contain multiple cell wall-anchored proteins that serve as an interface between the microbe and its environment. Some of these proteins act as adhesins and mediate bacterial attachment to host tissues. SdrG is a cell wall-anchored adhesin from Staphylococcus epidermidis that binds to the Bbeta chain of human fibrinogen (Fg) and is necessary and sufficient for bacterial attachment to Fg-coated biomaterials. Here, we present the crystal structures of the ligand binding region of SdrG as an apoprotein and in complex with a synthetic peptide analogous to its binding site in Fg. Analysis of the crystal structures, along with mutational studies of both the protein and of the peptide, reveals that SdrG binds to its ligand with a dynamic "dock, lock, and latch" mechanism. We propose that this mechanism represents a general mode of ligand binding for structurally related cell wall-anchored proteins of gram-positive bacteria.