XPath is a language for selecting nodes in an XML document. It uses path expressions that navigate the hierarchical relationship between XML elements, attributes, and text. Path expressions can select nodes by name, attribute value, position, or relationship to other nodes using axes like child, parent, and ancestor. Common XPath functions include count(), position(), and last() to evaluate node sets.