A total lunar eclipse occurs when the Earth moves directly between the Sun and the Moon, casting its shadow across the lunar surface.