The previous position did not quite involve a mating square; it involved a square (g6) that White needed on the way to delivering mate. Here is a similar idea. White's rook is aimed at Black’s knight, and that seems to be it—so far as attacks on Black pieces go. But observe that White’s bishop and queen both are trained broadly on the Black king’s position. They aren't yet attacking the same square, but there are lots of ways for a bishop aimed like this to be combined with an attack by the queen to create a mating threat. The problem is that the good ideas require the queen to get to g4 or h5 or both, and those squares are protected by Black’s knight—and so is h7, where the White queen might eventually like to land. This illustrates why knights on f3 or f6 in front of the castled king make such effective defenders.
So don’t just stand there; take the knight. White pictures RxN and imagines what he would be able to do if Black recaptured g7xR. The g-file would now be open, so now White could play Qg4+; it forces Black’s reply (Kh8) and so keeps control of the initiative. White’s bishop already attacks the square in front of the king’s new home (h7), so next White aims his queen there as well with Qf5. It isn’t a check, but there is nothing Black can do to prevent Qxh7# next move.
As usual, you have to assume Black will see these consequences and so will not play the recapture g7xR that leads to them. That means you win the knight, but let's look farther and consider what Black instead will do. His simplest good reply is Re8, giving his king some breathing room to the side; for what drives the mating attack here is the king’s trapped position in the corner. Re8 also keeps the g-file closed (i.e., it avoids moving the g7 pawn), and so prevents White from taking control with moves that give check. Now White has no straightforward route to mate—but it was the mating threat that turned his removal of the guard into the clean win of a knight.