Reversible protein phosphorylation is the most widespread regulatory mechanism in signal transduction. Autophosphorylation in a dimeric sensor histidine kinase is the first step in two-component signalling, the predominant signal-transduction device in bacteria. Despite being the most abundant sensor kinases in nature, the molecular bases of the histidine kinase autophosphorylation mechanism are still unknown. Furthermore, it has been demonstrated that autophosphorylation can occur in two directions, cis (intrasubunit) or trans (intersubunit) within the dimeric histidine kinase. Here, we present the crystal structure of the complete catalytic machinery of a chimeric histidine kinase. The structure shows an asymmetric histidine kinase dimer where one subunit is caught performing the autophosphorylation reaction. A structure-guided functional analysis on HK853 and EnvZ, two prototypical cis- and trans-phosphorylating histidine kinases, has allowed us to decipher the catalytic mechanism of histidine kinase autophosphorylation, which seems to be common independently of the reaction directionality.