Older rock tends to lie underneath younger rock. As a general rule, this works, but there are many factors to take into consideration.
Earth’s surface constantly moves and shifts. Sometimes, older rock is folded on top of younger rock, or catapulted from a volcano, for instance. To take these events into account, the whole composition of a rock formation must be considered.
Superposition says that the uppermost layer of rock is younger than what is below it. However, if you find a layered rock that is folded over other rock (a consequence of an earthquake, for instance), to figure out the relative ages of the layers, you must imagine unfolding the whole formation instead of just looking at one piece of it.
Perhaps a shaft of magma shot upward from the mantle, but didn’t break through the surface. Imagine three layers: limestone, shale, and sandstone. Suddenly a mile down the road, the layers become limestone, shale, granite, and sandstone.
The problem to solve is how the granite got there. It is likely that at some point, a channel of magma tried to escape to the surface, but was stopped and metamorphosed into granite. The granite would still be younger than the rock it had cut through, even though it appeared third from the top.