Cohomology is a mathematical tool used in algebraic topology to study and classify topological spaces by associating algebraic invariants to them. It provides a way to measure the 'holes' or 'voids' in a space, complementing homology by offering a dual perspective that often reveals additional structure and relationships.