An eclipse occurs when the moon passes between the Earth and the Sun, casting a shadow on the Earth's surface.