Literally, it means “god out of the machine.”
In literature, it means a “an unexpected power or event saving a seemingly hopeless situation, especially as a contrived plot device in a play or novel.” (Oxford Languages).
The key here being the word “contrived.”
Writers who have written themselves into a corner write themselves out by having “something” happen “suddenly” to solve the problem. In a way, it’s a companion of the “it was all a dream/simulation” ending that makes the story pointless because the jeopardy wasn’t real.
The characters or the world were never in mortal danger, the stakes weren’t real, all those emotions you felt while reading were not real either, because waiting in the wings were the cavalry, the vampires, the superheroes, or whatever god that Mr. Wizard was planning on deploying for a trick ending.
This is why it’s also a favorite of the amnesia hacks.
- She has amnesia you see, so now you don’t know that she is The One.
- Her lack of a past allows me to recast her as a sympathetic character, but in real life she’s horrid. Aren’t I clever?
- Oh look, she remembers just in time to save the day.
Six Sense* is the only movie I can think of that often gets accused of being a deus ex machina, or gets held up as an example by the amnesia hacks, but is neither. We were told up front, “I see dead people” so he wasn’t withholding any information, even if he used camera angles to trick you. You misunderstanding is not the same as him cheating. It’s not an amnesiac gotcha either. Crowe didn’t forget that he had died. He didn’t know he had died. And no, we’re not going to talk about the book. The book doesn’t get away with what the movie can get away with.
*As an Amazon Associate I earn from qualifying purchases. You can support this blog by shopping via these links or by using the tip jar. If you liked my commentary/analysis and want to read stories written in the same vein, please consider buying and reading one of my books. Thank you.
Wikipedia has a less biased explanation here.