Gas is a unit used in Ethereum that measures the amount of computational effort required to execute a transaction or smart contract. Every operation on the Ethereum network has an associated gas cost. While gas is used to measure computational work, fees are actually paid in ether using a gas price. The total fee paid is calculated as gas used multiplied by gas price. Gas ensures transactions pay appropriately for their computational requirements and prevents spam on the network. Running out of gas results in transaction failure, while providing too little gas price means a transaction won't be included in a block.