Why was this move in a puzzle? I was on the chess.com app this morning doing the daily puzzle and it wanted me to play Re2. This is questionable to me, because it just delays the mate, but I figured I might have missed something. Then what really perplexed me is that Black then plays Qg7. It appears to me that Black is sacrificing his queen for no reason when he has a mate in 2. I don't see how White has time to mount an attack on Black or come back to defend in time. What am I missing? 

[FEN "5r1k/1pQ4p/3nB1p1/3P4/5p2/1P5P/rq5P/4R1RK w - - 0 1"]

1. Re2 Qg7 2. Qxg7+ Kxg7 3. Rxa2
If black plays QxR then white plays Qc3+ with mate to follow. Black's Qg7 stops the mate. With the black queen on b2 white cannot play Qc3. The Re2 move is to divert the black queen

[FEN "5r1k/1pQ4p/3nB1p1/3P4/5p2/1P5P/rq5P/4R1RK w - - 0 1"]

1. Re2 Qxe2 2. Qc3+ Qe5 3. Qxe5+ Rf6 4. Qxf6#