Back to Blog
Plot & Structure8 min read

Deus Ex Machina Examples: Complete Writer's Guide

A deus ex machina is the ending that solves itself โ€” a rescue nobody set up, a coincidence that arrives exactly when your hero is cornered. Some are lazy cheats. A few are quietly brilliant. This guide defines the term, walks through famous examples from Greek tragedy to modern film with an honest verdict on each, and shows you how to earn your climax instead of bailing it out.

Definition

A deus ex machina is an improbable, unprepared-for event or character that appears out of nowhere to resolve a story's central conflict โ€” solving a problem the plot itself gave the characters no means to solve. In plain terms: the writer paints the hero into a corner, then knocks a hole in the wall.

"God from the machine": where the term comes from

The phrase is Latin for "god from the machine," and it is a stage direction before it is a criticism. In classical Greek theatre, a god was lowered onto the stage by a crane โ€” the mฤ“chanฤ“ โ€” to sort out a plot the mortals had tangled beyond repair. The god descended, decreed an outcome, and the play ended. The machine was literal: ropes, a wooden arm, an actor dangling above the orchestra playing Apollo.

Euripides leaned on the device so often that it became his signature โ€” and his weakness. Aristotle, writing in the Poetics a few generations later, laid down the rule we still argue about today: the resolution of a plot must arise from the plot itself, not from stage machinery. The moment a story reaches outside its own logic for a fix, it stops being a story and becomes a rescue. Twenty-four centuries later, that is still exactly why the technique fails when it fails.

Famous deus ex machina examples โ€” and whether they work

Not every rescue is a cheat, and not every cheat is fatal. Here are six of the most-cited examples across two and a half millennia, each with a verdict on whether the ending is earned, forgivable, or a genuine con.

Medea โ€” Euripides

Contested

The original. After murdering her children, Medea escapes justice in a chariot drawn by dragons, sent by her grandfather the sun god Helios. No setup, no cost โ€” she simply floats away. This is the literal deus ex machina.

Defensible only because the whole cosmos of the play is ruled by capricious gods who intervene at will. Even so, it is the ending that gave the device its bad name.

The War of the Worlds โ€” H. G. Wells

Earned

Humanity is losing. The Martian machines are unstoppable โ€” and then the invaders drop dead, killed by Earth's bacteria, against which they have no immunity.

It looks like a bail-out but it is seeded from page one: the novel is soaked in biology, natural selection, and the theme of the unprepared organism. The microbes were always there. The reader just wasn't looking at them.

The eagles โ€” The Lord of the Rings

Contested

The Great Eagles swoop in to lift Frodo and Sam off the slopes of Mount Doom, and again at the Black Gate. The internet's favourite "why didn't they just fly the Ring to Mordor?" complaint.

Contested, and mostly unfairly. Gwaihir and the eagles are established long before the climax, they answer to Gandalf, and they never once solve the central problem โ€” the Ring still has to be carried and destroyed on foot. A rescue, yes. A cheat, no.

The T. rex finale โ€” Jurassic Park

Cheat

Cornered by raptors in the visitor centre, our heroes are saved when the T. rex crashes in and eats the raptors at the perfect moment โ€” then lets the humans stroll out.

A pure coincidence with zero setup, and technically a cheat. It survives because the film has spent two hours teaching us the park is chaos and nobody is in control โ€” so raw luck is, weirdly, on theme. Forgivable spectacle, not craft.

The naval officer โ€” Lord of the Flies

Earned

As the boys hunt Ralph to kill him, a British naval officer suddenly appears on the beach, and the savagery collapses into a child's tears in an instant.

A deus ex machina used on purpose. Golding wants the abrupt rescue to feel hollow โ€” the officer's own ship is a warship, the adult world is just savagery with better uniforms. The device indicts the ending it provides. Intentional, and it works.

The coincidences โ€” Oliver Twist

Cheat

An orphan is repeatedly rescued by strangers who turn out to be his long-lost relatives, and every villain is conveniently connected to his secret parentage.

Victorian convention, and it dates badly. Dickens leaned on benevolent coincidence because his readers accepted providence as a plot engine. To a modern reader it reads as a stacked deck โ€” the clearest kind of unearned resolution.

Why deus ex machina usually fails

The problem is almost never the surprise. Readers love surprises. The problem is the broken contract.

It breaks the promise of the setup

Every obstacle you write is an implicit promise that the hero will have to overcome it with what they've got. Solve it from outside and you retroactively make every prior struggle pointless. The reader doesn't feel relief โ€” they feel conned out of the payoff they were saving up for.

It steals agency from the protagonist

Stories are about characters who act. When rescue arrives from the sky, the hero becomes a bystander at their own climax. The single most reliable diagnostic: at the decisive moment, is your protagonist doing something, or is something being done to them?

It signals a plotting problem upstream

A deus ex machina is usually a symptom, not a disease. It means the ending was written before the tools to reach it were planted. The fix is rarely at the ending โ€” it's twenty thousand words earlier, where the rope, the ally, or the flaw should have been introduced.

When a deus ex machina actually works

There are exactly three ways to make the device land, and all of them convert it from a cheat into a choice.

When it's seeded (and stops being a deus ex machina)

The War of the Worlds trick works because the rescue was planted early and simply not noticed. This is the great loophole: a resolution that looks impossible but was quietly set up hundreds of pages ago is not a deus ex machina at all โ€” it's a payoff. The art is hiding the setup in plain sight. Foreshadowing turns "cheat" into "of course."

When the world runs on divine intervention

In a cosmos where gods, fate, or magic demonstrably act โ€” Greek tragedy, some mythic fantasy, magical realism โ€” an intervention from above is inside the rules, not outside them. The test is consistency: if a god saves the hero in act three, gods must have been visibly meddling since act one.

When it's ironic and deliberate

Golding's officer and the comic "and then the animator had a heart attack" gag in Monty Python and the Holy Grail both weaponise the device. Used knowingly โ€” to deflate, to indict, to make the reader feel the wrongness of an easy out โ€” the deus ex machina becomes a scalpel. But you have to mean it, and the reader has to know you mean it.

How to earn your ending instead

If your climax currently depends on a lucky break, here is the repair sequence โ€” in order.

  1. 1

    Plant the solution early

    Whatever saves your hero in chapter thirty should first appear, harmlessly, in chapter four. The ally, the skill, the object, the weakness in the enemy โ€” introduce it long before it matters, doing something else, so the reader files it away without suspicion.

  2. 2

    Make the hero the instrument

    Rewrite the climax so the resolution passes through a choice or action your protagonist makes. Even if outside help arrives, the hero must earn it, trigger it, or pay for it. Help that the character summons is earned; help that merely happens is a cheat.

  3. 3

    Charge a price

    An unearned rescue costs nothing, which is exactly why it feels weightless. Attach a cost โ€” a sacrifice, a wound, a relationship spent โ€” and even a sudden turn reads as consequence rather than convenience.

  4. 4

    Reverse-engineer from the setup

    The cleanest defence is structural: outline the ending first, then work backwards, listing every element the resolution requires and where each must be planted. When the plan comes before the prose, deus ex machina simply has nowhere to sneak in.

Build a climax that pays off its setup

Most accidental deus ex machinas are outlining failures, so the fix belongs at the outline stage. In AIWriteBook you can map the whole arc before you draft โ€” the builds a cause-and-effect plot where each turn is forced by what came before, and the lets you place the seeds of your resolution chapters ahead of the payoff, so the ending grows out of the setup instead of crashing into it.

If you want the surprise without the cheat, the free generates reversals you can pressure-test against one question: was this planted, or is it a rescue? Keep the twists that a re-read would justify; discard the ones that arrive from nowhere. And when an existing climax already reads as a bail-out, the chapter AI chat rewrites it a scene at a time โ€” showing every change as a diff you accept or reject โ€” so you can hand the decisive act back to your protagonist without rewriting the whole book.

For the structural side of this โ€” how a climax should sit inside a complete arc โ€” our walks through exposition, rising action, and the climax's job, and the shows where a genuine, earned turn belongs in the classic monomyth.

Free to start

Outline an ending you've actually earned

Plant your resolution chapters early, force every turn from cause and effect, and keep your hero at the centre of the climax โ€” starting from your own premise.

Is your ending a cheat? Run the six-point test

Tick every statement you can honestly make about your climax. Anything you can't tick is where the rescue is hiding.

0 of 6 checks passed

Deus ex machina and its relatives

The device sits inside a small family of setup-and-payoff ideas worth knowing by name.

Chekhov's gun

The rule that every element must earn its place: if a rifle hangs on the wall in act one, it must fire by act three. Deus ex machina is Chekhov's gun in reverse โ€” a rifle fired in act three that was never on the wall.

Foreshadowing

The cure. Foreshadowing plants the future in the present so a later turn feels inevitable rather than convenient. Most "good" deus ex machinas are just foreshadowing you didn't notice.

Plot armour

The sense that a character can't die because the story needs them. A cousin problem: where deus ex machina rescues the plot, plot armour rescues the person โ€” and both drain tension by removing real risk.

Ex machina, inverted

A diabolus ex machina is the same trick turned cruel โ€” a sudden, unearned catastrophe that arrives to force a tragic ending. It cheats in the opposite direction, and readers resent it just as much.

Deus ex machina FAQ

No. It's bad when it's unearned โ€” when the resolution reaches outside the story's own logic and steals the payoff. It's fine, even powerful, when it's seeded early, when the world genuinely runs on divine or magical intervention, or when the writer uses it deliberately for irony. The device isn't the sin; the broken promise is.

Keep the crane in the wings

Deus ex machina has been a byword for lazy plotting since Aristotle, but the real lesson underneath the Latin is more useful than the insult: a story has to resolve on its own terms. Plant your solutions, keep your hero at the centre of the climax, and charge a price for every rescue, and you'll never need a god to descend on a rope.

And when a twist genuinely surprises you as you draft, don't reject it โ€” interrogate it. If a re-read would justify it, you've found a payoff. If it arrives from the sky, you've found a symptom, and the cure is twenty thousand words back.

Explore the full How to Write a Book guide for structure, plotting, and endings that earn themselves โ†’

AIWriteBook

Write an ending your readers will believe

Outline a cause-and-effect plot, seed your resolution early, and revise any rushed climax with accept/reject diffs โ€” free to start.

No credit card required. Your premise, your voice, your ending.