A relay is an electrical switch that is activated by an electric current. It consists of an electromagnet and a set of contacts. When a current passes through the electromagnet, it creates a magnetic field which acts on the contacts to open or close the circuit. This switch can be used to control the flow of electricity in a circuit by switching it on or off. Relays are used in a variety of applications, such as controlling electrical motors, lighting, and safety circuits. They are also used in automated systems to control the flow of data between components.