A smart contract is a self-executing ethg contract with the terms of the agreement directly written into code. It runs on blockchain technology, ensuring automatic execution when conditions are met.