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