A foreign key is an attribute (or set of attributes) in one table that references the primary key of another table, establishing a relationship between the two tables. This constraint enforces referential integrity between related tables in the database.