Abstract: Many macromolecules, namely proteins, show functional substructures or epitopes defined by characteristic spatial arrangements of groups of specific atoms or residues. The identification of such substructures in a set of macromolecular 3D-structures solves an important problem in molecular biology as it allows the assignment of functions to molecular moieties and thus opens the possibility of a mechanistic understanding of molecular function. We have devised an algorithm that models a functional epitope formed by a group of atoms or residues as set of points in cartesian space with associated functional properties. The algorithm searches for similar epitopes in a database of structures by an efficient multistage comparison of distance sets in the epitope and in the structures from the database. The search results in a list of optimal matches and corresponding optimal superpositions of query epitope and matching epitopes from the database. The algorithm is discussed against the background of related approaches, and it is successfully tested in three application scenarios: global match of two homologous proteins, search for an epitope on a homologous protein, and finding matching epitopes in a protein database.