White’s a-pawn steps up to a8, turns into a rook, and Black is mated on the spot.
8
7
A queen would have mated too, so the choice made no difference here. What matters is that the rook was allowed. Every one of the four pieces is a legal answer on that square, and the Laws do not ask you to justify the one you pick.
What is allowed, and what is not
Queen, rook, bishop, knight. Your own colour. Chosen as part of the same move, and finished when the piece is standing on the promotion square.
What is not on the list is more interesting than what is:
Not a king. A pawn cannot promote to a king under any circumstances, and the reason is worth two minutes.
Not a pawn, and not nothing. The pawn cannot stay a pawn on a8 while you decide, and it cannot promote to another pawn to keep the position quiet. Article 3.7 of the FIDE Laws uses must.
Not an enemy piece. A new bishop on a8 belongs to whoever pushed the pawn.
And there is no limit on duplicates. Your queen on d1 is no obstacle to a second queen on a8, which is where the two queens question comes from.
Which of the four to actually pick
The values do most of the arguing: nine for a queen, five for a rook, three each for bishop and knight. Take the queen unless you can see a specific reason not to, and by specific I mean a move you have calculated, not a feeling.
The knight earns its place often enough to be worth checking every time. It reaches squares no queen reaches, so it is the only promotion that can give a check or a fork the queen would miss. The rook earns its place when the new queen would leave the enemy king with no legal move and no check, which is stalemate and half a point thrown away. Those two cases are the whole of when not to promote to a queen.
Bishop promotion: legal, and almost never right
A bishop is worth the same as a knight but goes to no square a queen could not already reach, so promoting to one gives up six points for nothing. The only practical reason to do it is stalemate avoidance, and a rook does that job better in nearly every position.
Where bishop promotions really live is in composed studies and problems, where a composer needs exactly one piece to control exactly one diagonal and nothing more. If that kind of thing appeals, the chess problems post is a good way in, and the underpromotion puzzles will give you the practical version.