IP routing table - default route
A router will look through all of its routing entries in the Routing Table to find the one that best matches the intended destination. If no match is found, and if the “gateway of last resort” (or the default route) is set, only then will it send the packet to the default route.
For example, take a look at this routing table:
A destination IPv4 address of 192.168.12.5 will match the directly connected network on FastEthernet0/0. However, a destination address of 10.10.10.5 will not match any entry, and will thus be sent via the gateway of last resort, which has a next hop of 192.168.24.254, and an exit interface of FastEthernet0/1.
IPv6 operates in much the same way.
So the gateway of last resort, as its name suggests, will only be used if all other entries do not match.