An improbable, unearned solution that drops in from nowhere to resolve a story's conflict.
Deus ex machina (Latin for "god from the machine") is when a seemingly unsolvable problem is suddenly resolved by an unexpected and previously unestablished force, character, or event. The term originates from ancient Greek theater, where actors playing gods were literally lowered onto the stage by a crane to fix everything. In modern storytelling, it refers to any resolution that feels cheap because it was not set up or earned within the story's own logic.
Your reader invests time and emotion in your story's conflict. When you resolve it with something that comes out of nowhere - a previously unmentioned twin, a sudden inheritance, a convenient earthquake - you tell the reader their investment was pointless. Learning to spot and avoid deus ex machina will make your endings more satisfying and your storytelling more honest.
Medea escapes on a chariot sent by the sun god Helios - a literal god-from-the-machine ending that ancient audiences accepted as divine intervention.
A naval officer conveniently arrives just as Ralph is about to be killed. Some scholars argue this is intentional irony rather than lazy plotting.
Some readers felt the final resolution came too abruptly, though others argue it was seeded throughout the trilogy. The debate itself is a useful case study.
A surprise ending is fine as long as it was set up. If re-reading reveals planted clues, it is a twist, not a cheat. The test is whether the solution was possible within the story's established rules.
If your hero is trapped with no way out, go back and plant the seeds of escape earlier. The solution should already exist in the world you built.
First drafts often have placeholder resolutions. During revision, trace every resolution back to its setup. If there is no setup, add one or change the resolution.
Write a short scene where a character is in serious trouble - trapped, cornered, out of options. Then write two different endings: one that is a blatant deus ex machina and one that resolves the conflict using only elements already present in the scene. Compare how each ending feels.