Underpromoting to Avoid Checkmate
Underpromoting is promoting a pawn to a piece other than a queen. In most games it is necessary to promote to a queen, but in some it is crucial to underpromote. You have the choice of a knight, bishop, or rook. In most games that require underpromotion the pawn is promoted to a knight because the properties of the bishop and rook are combined in a queen. In this instance queening a pawn would be useless and still lead to a checkmate for black. The queen is unused and black still gets checkmate in 1. After white pushes away blacks king white can move towards stalemate.
In the last situation white had to try for stalemate and avoid checkmate, whereas in this situation white is trying for checkmate and avoiding stalemate. Using underpromotion in this situation is the only way to avoid stalemate and win the game.