C-xz calls repeat
which repeats the most recently-excuted command.
Note especially that you can keep repeating the command with only the final key in the sequence. e.g. C-xzzzzz
C-x z runs the command repeat (found in global-map), which is an
interactive autoloaded compiled Lisp function in ‘repeat.el’.
It is bound to C-x z.
(repeat REPEAT-ARG)
Repeat most recently executed command.
If REPEAT-ARG is non-nil (interactively, with a prefix argument),
supply a prefix argument to that command. Otherwise, give the
command the same prefix argument it was given before, if any.
If this command is invoked by a multi-character key sequence, it
can then be repeated by repeating the final character of that
sequence. This behavior can be modified by the global variable
‘repeat-on-final-keystroke’.
‘repeat’ ignores commands bound to input events. Hence the term
"most recently executed command" shall be read as "most
recently executed command not bound to an input event".
To quickly access a recent command via M-x just type M-p or <up> to move back through the command history.
If you want to repeat a command including the interactive arguments that you entered, you can use C-xM-: to call repeat-complex-command
(and once again the history is available).
repeat-complex-command is an interactive compiled Lisp function in
‘simple.el’.
It is bound to <again>, <redo>, C-x M-:, C-x M-ESC.
(repeat-complex-command ARG)
Edit and re-evaluate last complex command, or ARGth from last.
A complex command is one which used the minibuffer.
The command is placed in the minibuffer as a Lisp form for editing.
The result is executed, repeating the command as changed.
If the command has been changed or is not the most recent previous
command it is added to the front of the command history.
You can use the minibuffer history commands M-n and M-p
to get different commands to edit and resubmit.