How can I prevent checkmate in this position? It is White's turn to move. How can White avoid a checkmate?

[FEN "8/1kpP2q1/1p2P1p1/1P3pP1/5p1K/5P2/6P1/R7 w - - 0 1"]
Initial Analysis
White is clearly in a dire situation, since Black is threatening mate in one on either h7 or h8 if White doesn't do anything. But the White king can't move move nor can White get rid of any of the pawns that surround the king. White's rook, the only White piece, is too far away to do anything. The move 1. Ra8? to try and stop 1... Qh8# fails to 1... Qh7#. Promoting White's ppawn with 1. d8=Q? also fails to 1... Qh7#. So what can White do now?
Assessment Of Available Options
In order to prevent Black from moving the Black queen, White must give a check to the Black king so that Black is legally obligated to move the king instead of the queen. However, what check is there for White give? Ra7+ doesn't work because the Black king will just take it and White cannot stop both mating threats. So it seems that White is totally losing.
However!
There is only one move that can save White, which often goes unseen by many first time problem solvers-underpromotion to a knight with check: 1. d8=N+! After 1... Kb8 (not 1... Kc8?, as that allows  2. Ra8#) White can forcibly checkmate Black in 4 moves with a constant stream of checks as any non-checking move loses. Therefore, White is not losing as it seemed before!
[FEN &quot;8/1kpP2q1/1p2P1p1/1P3pP1/5p1K/5P2/6P1/R7 w - - 0 1&quot;]

1. d8=N+ Kb8 2. Nc6+ Kb7 3. Ra7+ Kc8 4. Ra8+ Kb7 5. Rb8#

It is important to note that while 2. Nf7 seems like an option to block the Black queen, as suggested by @Loren Petchel in a comment, it actually loses as Black can then play 2... Qxa1!, and it is mate on the next move with 3... Qh1# no matter what White plays.