Lesson
White to move. Main line: 1. Qxg7#
Qxg7# removes the pawn and checks the king from the neighboring square. The queen controls g8 and h7 directly, so the cornered king has no square to which it can move.
The white king on f6 protects g7. That detail makes Kxg7 illegal and converts what would otherwise be a queen blunder into checkmate. A contact check cannot be blocked, leaving Black with no defensive mechanism.
Queen contact mates are powerful but demand an exact defender count. Before placing the queen beside a king, verify its protection and every adjacent flight square; one unguarded square changes mate into a lost queen.