Can the king capture his attacker?
There are three ways to get out of check.
- Simply move the king away.
- Block the check, or place a piece in between the king and the opponent's attacking piece.
- Capture the piece that's checking the king.
All of these cases are dependent on the fact that immediately after you make your move, the king is not in check. Therefore, you may capture the queen so long as the king is no longer in check after you make your move.
There is a case, under FIDE Laws, where a king cannot capture an unprotected adjacent queen:
[Title "Queen is safe"] [fen "4k3/4Q3/8/8/8/8/8/4K3 w - - 0 1"]
The point is of course that the game is dead: there is no possible checkmate, so the game ends immediately in a dead draw. But hang on: isn't this checkmate then? Black is in check but can't escape.
The answer to the apparent paradox is that checkmate is defined to be when a player is in check, and has no legal moves. KxQ is perfectly legal, but it's just not "playable" (there is no official word for this) as the game is over.
In exactly the same way, a dead position where no-one is in check (e.g. the diagram above without the wQ) is not a stalemate.