The cell wall envelope of staphylococci and other Gram-positive pathogens is coated with surface proteins that interact with human host tissues. Surface proteins of Staphylococcus aureus are covalently linked to the cell wall envelope by a mechanism requiring C-terminal sorting signals with an LPXTG motif. Sortase (SrtA) cleaves surface proteins between the threonine (T) and the glycine (G) of the LPXTG motif and catalyzes the formation of an amide bond between threonine at the C-terminal end of polypeptides and cell wall cross-bridges. The active site architecture and catalytic mechanism of sortase A has hitherto not been revealed. Here we present the crystal structures of native SrtA, of an active site mutant of SrtA, and of the mutant SrtA complexed with its substrate LPETG peptide and describe the substrate binding pocket of the enzyme. Highly conserved proline (P) and threonine (T) residues of the LPXTG motif are held in position by hydrophobic contacts, whereas the glutamic acid residue (E) at the X position points out into the solvent. The scissile T-G peptide bond is positioned between the active site CyS184 and Arg197 residues and at a greater distance from the imidazolium side chain of His120. All three residues, His120, Cys 184, and Arg197, are conserved in sortase enzymes from Gram-positive bacteria. Comparison of the active sites of S. aureus sortase A and sortase B provides insight into substrate specificity and suggests a universal sortase-catalyzed mechanism of bacterial surface protein anchoring in Gram-positive bacteria.