Deus Ex Machina / Literature

  • A frequent criticism of Twain's Adventures of Huckleberry Finn, where after Tom's plan to free Jim fails miserably, he reveals that Jim's owner had died off-screen, her will manumitting him, and the whole thing had just been for fun. Ernest Hemingway famously referred to this ending as "cheating."
  • At the end of Dave Duncan's tetralogy A Handful of Men, the heroes are in a totally hopeless situation. Thanks to his army of sorcerers with loyalty spells on them, the Big Bad has become the most powerful sorcerer ever. He's even become more powerful than the main character was at the end of the previous series - and said main character was a demigod (one Power Level higher than a sorcerer) who only avoided a Superpower Meltdown because his Love Interest managed to depower him before he burst into flames and died from it. Having been on the run from the Big Bad throughout the whole series, the heroes have finally been captured and are about to be killed. They end up being saved when two of the heroes achieve the Power Level above "sorcerer" without having a Superpower Meltdown by becoming a complete god instead of a demigod, and proceed to free everyone from the Big Bad's Mind Control sorcery. Several of the main characters knew how to do this, but, normally, becoming a full-fledged god means that you Ascend to a Higher Plane of Existence and simply stop caring about what happens to mere mortals, so it's never mentioned as a way to stop the Big Bad until it happens.
  • The Alex Rider series follows the third way to the letter just like the James Bond movies. A teenage spy is sent into a mission with a small collection of gadgets. Of course he uses them all to save his own neck just in time and stop the current madman from destroying the world.
    • Another one happens when Alex is running from some gunmen and ultimately runs to the rooftop of a building with no way down and the gunmen on the stairs. But then Alex remembers seeing a giant orange cone/construction equipment (not mentioned before) and jumps off the building into it, allowing him to slide from safety away from his assailants.
  • A Series of Unfortunate Events: Lampshade Hanging and a Discussed Trope in Book the Seventh. Violet, Klaus, and Sunny have been accused of murder and are in a jail cell that they have no chance of escaping from. It's Klaus's birthday, and he states that the one thing he wants more than anything is some Deus Ex Machina. A police officer shows up and grudgingly gives them some bread and water. Violet turns to Klaus and says "Happy Birthday" and they use the bread and water to melt the mortar between the wall's bricks, letting them escape.
  • Spike Milligan's Badjelly the Witch. The eponymous witch is chasing the hero and heroine, who are fleeing her lair, when God Himself intervenes. When she refuses to back down and tries to blind him with her fingernails, he annihilates her.
  • This happens almost constantly in the first book of The Bartimaeus Trilogy, where something coincidentally happens to save the titular character when he gets into a seemingly inescapable situation (managing to escape from captivity when a little girl crashes her bike into the bushes where he's being interrogated in).
  • In Beowulf, the Giant's sword that kills Grendel's mother was only mentioned moments before Beowulf takes it and kills her with it. She couldn't be harmed by weapons made by man, but she conveniently kept a sword crafted by Giants (which would be able to harm her) above the door.
  • In The Blue Sword by Robin McKinley, the main character, Hari, is vastly outnumbered by the enemy army but she sends her ragtag group of friends out to fight them anyway. Then, most of them die, and she gets super upset. She climbs to the top of a convenient cliff that wasn't there a minute ago, and uses her amazing magic powers that she didn't know she had to bring an entire mountain range down on the enemy army. Wouldn't it have been nice if she'd done that to begin with? Now, it was shown that Hari had some magic she was being trained in low-level magic!
  • This happens literally in Calculating God when near the end God appears to save the three known species from their destruction by a supernova.
  • Intentionally but carefully used in the Chalion series, each book has one of the gods intervening in some dramatic and unexpected way to resolve the situation. Justified, since the gods have very restrictive limitations on how and when they can interact with the world, and usually have to keep their followers in the dark until the big moment in order to keep their plans from being derailed.
  • In C. S. Lewis's The Chronicles of Narnia, Aslan, who is a Jesus/God Captain Ersatz so it's not that surprising, spends the entire series behind the scenes, spinning the adventure and coming before them only when they need him most. He comes in during the last battle in Prince Caspian to help the Narnians win after they began to lose hope.
  • Anything by Simon R. Green, especially his Deathstalker series, lives and sustains itself on this trope. All of the heroes' asses must be sore from pulling plot devices and powers out of them.
  • The end of the Circle of Magic book Battle Magic ends Yanjing's invasion of Gyongxe with a literal Deus Ex Machina. Gyongxe really is the home of the gods and they've decided they're done with being invaded and conquered.
  • Valerie's death in Cousin Bette may be considered this for the Hulot family. The young, healthy woman who has a personal vendetta-by-proxy against the Hulots and who can manipulate any man to get what she wants just happens to have a "savage" ex-lover who is crazy enough to kill her, and he just happens to have access to this exotic weapon of murder that will give the victim enough time and incentive to ruminate over all her past sins and promptly decide to redeem herself by leaving almost all her fortune to the people whom she had, up until that point, considered her enemies.
  • In Robin Jarvis' prequel to the Deptford Mice trilogy, The Oaken Throne, Ysabelle is tricked by the treacherous Morwenna into descending far below the Hallowed Oak and becoming trapped in a locked room where hungry toads are waiting to devour her. There seems to be no way out, but somehow Vesper (who is outside in the midst of a presumably noisy battle) is able to not only hear her cries, but quickly find his way down a dark maze of unfamiliar passages (it was previously noted that even Morwenna, who was familiar with them, had some trouble navigating) to rescue her.
  • The first Discworld book, The Colour of Magic, has some rather literal applications of Deus Ex Machina. There are two that are justified in that Rincewind is Lady Luck's favorite game piece in the tabletop RPG of the gods. Another at the end of the third chapter relies heavily on Rule of Funny.
    • Played with in the ending of Small Gods, which relies heavily on literal divine intervention; given the subject matter, however, it was rather a given. It also is the culmination of some heavy Character Development by the god in question.
    • Monstrous Regiment plays the trope much straighter, which brought about much debate and anger from the readership.
  • The reason why the final work of David Eddings, the Dreamers Tetrology, was so poorly received was because every single book ended with the titular Dreamers having a dream that causes a natural disaster that destroys the enemy army. By the third book, the entire cast is fully aware of this fact, and knows that their job is to buy time until the next Deus Ex Machina solves all their problems. Then in the final book, another Deus Ex Machina turns up which causes the Big Bad to have actually been defeated several centuries in the past, making the entire series technically never happen.
  • In the eighth book of Jim Butcher's The Dresden Files, Proven Guilty, Harry Dresden literally banks on a Deus ex Machina occurring. This isn't as far-fetched as it seems, as the person he's helping at the time is the daughter of Knight of the Cross Michael Carpenter, who has Contrived Coincidence as a superpower. Harry's expectation is that the Almighty will protect His Knight's child out of professional courtesy if nothing else. When Dresden's attempts to save her fail, Michael shows up, having saved the lives of some of the people out to kill her, who are required to spare her life in gratitude.
  • A Draco Ex Machina conveniently kills the villains at the end of Tehanu.
  • The Eye of Argon has a beauty. Grignir, the barbarian protagonist, is locked in combat with a bunch of cultists. During the fight, one of his opponents just drops dead in the middle of the fight from an epileptic seizure.
  • In Bulgakov's The Fatal Eggs, an army of giant tropical animals is advancing towards Moscow, when they are all killed off by an unexpected frost. Bulgakov calls the chapter "A Frosty Deus Ex Machina".
  • At the end of the Goosebumps book "How to Kill a Monster", the monster has the kids cornered and is about to eat them. But it turns out that the monster who survived ingesting drain cleaner, rat poison, ammonia and turpentine is allergic to humans and drops dead immediately after licking one of them.
  • House of Leaves has one, in which Will Navidson inexplicably returns from the abyss inside the house after having been inside for several days with no food or water, or any real conception of where he was. Throughout the book, the House only directly kills one person, with the other deaths all being a result of insanity. The house has a history of letting people escape its depths right before they would die of starvation or exhaustion.
  • The House of Night:
    • Literally. When Kalona kills Stark in Nyx's realm, the Goddess Nyx shows up and forces Kalona to bring him back to life.
    • Happens again, in Awakened with Nyx appearing at Jack's funeral to comfort Jack's boyfriend Damien, and to help the Raven Mocker Rephaim get over his demonic nature (by turning him into a boy at night) so he can truly love Stevie Rae.
  • Various gods interfere in the affairs of men all over the place in Homer's epics Iliad and The Odyssey, often to save heroes they favour, especially Odysseus and Telemachus in the latter epic. The most egregious example in the Iliad is probably the duel between Menelaus and Paris, where Menelaus has Paris at his mercy only to have Aphrodite spirit him away, while in the final book of the Odyssey the intervention of Zeus himself defuses and ends the confrontation between Odysseus' family and the relatives of the dead suitors after just one man is killed.
  • Inheritance Cycle.
    • Eragon: Murtagh's sudden appearance.
    • Eldest: the dance of the naked elf chicks to cure all of Eragon's ailments. And turn him into a half-man, half-elf instantly when the process is supposed to be slow and gradual and therefore gives him Rider skills and senses instantly rather than it taking years.
    • Inheritance: Basically everything. Seriously. The entire army of werecats appearing despite the fact that we've only met two in the past three books, the discovery of an essentially invincible anti-dragon weapon which had never been mentioned previously, Angela finding Albitr, the 'sharpest sword in existence', to save the heroes, the Eldunari on Vroengard having powers Galbatorix's far larger store never had, the unexplained 'carrying spell' the Eldunari teach Saphira, the very minor character form a previous book saving Roran in the final battle, then disappearing, the side-effects on the Varden's spellcasters randomly disappearing, Murtagh stripping all of Galbatorix's wards using a spell it is not stated Galbatorix ever risked teaching him and Arya and the elves emerging unharmed from the citadel which was just blown up, carrying the last dragon egg and several hundred Eldunari...
    • The Dragons as a whole. The explanation actually given in the text is that no one knows how dragon magic works, it just does in times of need. Basically, Lampshade Hung with a massive neon sign. Here come the debates about whether they truly are a deus ex machina or just a very convenient plot device.
  • Invoked and lampshaded in the Star Trek novel I, Q by John de Lancie, in which Q, suddenly powerless, finds himself trying to survive on a raging battlefield and is surprised that he's lasted this long. The next time a rabid fighter charges him he just stands there until he's about to be torn apart when... an anvil falls on his attacker. Q is quite disappointed with this largely because the Deus in question turns out to be an old enemy of his.
  • In The Kite Runner, Baba's life is saved by a Russian soldier's officer suddenly appearing and shooting up in the air at the same time the reader and protagonist expect the soldier to be shooting Baba for standing up to him.
  • L. Frank Baum loved using this. Virtually all of the Oz books end this way. Sometimes there's an attempt at setting things up via Chekhov's Gun, but just as often the ending comes completely out of the blue.
    • In his sixth Oz book, The Emerald City of Oz, the Nomes and a few other unruly tribes of creatures plan to invade Oz, destroy it, and enslave the people. The surprise is initially ruined by Ozma's convenient Magic Picture, allowing her to plan ahead of time. With her trusty Chekhov's Gun, the Magic Belt Dorothy stole from the Nome king in a previous book, Ozma uses its power to dehydrate the army, whose invasion tunnel is conveniently right next to the fountain containing the Water of Oblivion, which makes anyone who drinks of it forget everything. The first thing the invaders do when they come out of the tunnel is drink the water; war avoided.
  • The Left Behind series ends with a Deus Ex Machina of sorts, though, given the philosophy put forth in the novels, this is probably intentional.
  • Cory Doctorow loves this trope. In Little Brother, the protagonist is being waterboarded and the cavalry rush in to save the day, in Someone Comes To Town, Someone Leaves Town the protagonist's flying girlfriend whisks him away from danger to a desert island and in Eastern Standard Tribe the protagonist just happens to become friends with a doctor at the asylum he is in who can and will free him.
  • Most famously portrayed in "Little Red Riding Hood", with the woodcutter appearing out of nowhere to save her just in the nick of time; though he is established earlier in the plot, nevertheless he isn't following Red around to protect her, but pops up to kill the Wolf anyway.
    • That's because in the earliest versions there was no woodcutter.
    • In Charles Perrault's version, the oldest written one, she's just eaten and that's the end of that. In French folk version, collected later but suspected to have been Perrault's source, she tells the wolf she has to go to the bathroom and slips off when she does.
    • Ludwig Tieck's version, which predates Grimms' Fairytales, follows Perrault, but because Tieck evidently did not like the wolf getting away with eating the grandmother and Little Red Riding-Hood, he added a passing hunter who discovers the wolf in grandma's house and shoots it dead. It was only The Brothers Grimm or, quite likely, their source for their version, Jeanette Hassenpflug, who added the miraculous survival of the two victims of the wolf — which looks as if it may have been modeled on "The Wolf and the Seven Young Kids". In later English versions of the Grimms' version the hunter became a woodcutter and he also was established earlier in the story.
  • A literal example in The Long Dark Tea-Time of the Soul, when a god of guilt comes out the oft-mentioned refrigerator to resolve the plot in five pages.
  • Deliberately done in Lord of the Flies, where after Jack sets the island on fire to kill Ralph, a Navy ship shows up out of nowhere to rescue them, symbolizing how quickly the appearance of an authority can change everything.
  • Steven Erikson's Malazan Book of the Fallen has Dei Ex Machina galore. Some examples:
    • The appearance of the titular Gardens in Gardens of the Moon.
    • The appearance of the Trygalle Trading Guild in Deadhouse Gates.
    • The appearance of the army of Bridgeburner ghosts in House of Chains.
  • In Masks Of Aygrima, When Mara's body is about to be taken over by The Autarch, Greff, who apparently infiltrated the Palace without being stopped by any of the hundreds of guards, runs in and stabs The Autarch, distracting him long enough for Mara to kill him.
  • The Mill on the Floss by George Eliot. When Maggie runs off with Stephen and returns, she is shunned by her brother and has insulted Phil. While sitting in her cabin alone and brooding, a flood rips through the town and drowns her before she has an opportunity at reconciliation. References throughout the novel to the flooding of the countryside and water in general place this in the second variety.
  • The entire plot of Jules Verne's The Mysterious Island is about characters trying to find out why and how someone bails them out of seemingly hopeless situations. (And that "someone", being Captain Nemo, does it in the most dramatic manner possible all the time.)
  • Averted in the The Night's Dawn Trilogy by Peter F. Hamilton. The threat to human civilization is so unstoppably powerful that, when evidence of an encounter with a literal god is discovered in the ancient records of an alien species, the humans are desperate enough to dispatch an expedition to track down this god and beg for its help. This subplot is even telegraphed in the title of the trilogy's final book, The Naked God. As the result of all this lampshading, the story's resolution is neither sudden nor unexpected, and therefore not a Deus ex Machina, even though it does involve direct intervention by a deity.
  • Near the end of The Last Colony, John sends Zoe off to give a message to General Gau. She returns with a "sapper field", just what's needed for the Roanoke colony to win the final confrontation. This one irritated readers so much that John Scalzi devoted the closing third of Zoe's Tale to explaining how exactly she got it — it was much trickier than it looked from the outside.
  • Throughout David Weber's Out of the Dark the Shongairi invaders consistently lose ground battles to humans but pulverize the entire area from orbit afterwards. Towards the end they learn enough human tactics to capture a rebel village without resorting to orbital bombardment and develop a bioweapon to destroy what's left of humanity. But just as they're about to deploy the virus the leader of the village they captured to experiment on turns out to be freakin' Dracula and he and a handful of newly-spawned vampires single-handedly wipe out the entire invasion force. Hints that Dracula was present were scattered throughout the book, but were relatively subtle, and the reader is expecting a hard sci-fi war novel, and not fantasy elements to creep in and sucker punch them.
  • The Priest The Scientist And The Meteor has the title priest praying to God, resulting in a huge golden bat appearing that knocks the dinosaur-ghost ridden meteor out of the park.
  • Bjorn Nyberg and L. Sprague de Camp's "The Return of Conan" has Conan the Barbarian's god, Crom, intervene at the climax to save Conan. Early in the novel, Conan has a vision that Crom is speaking to him; later, Conan sacrifices to Crom. It seems the authors—who took over the Conan canon from the creator, Robert E. Howard, after Howard's suicide and the success of the character—wanted to imbue Conan with middle-class values, and making him more religious went along with that. Still, this is a textbook example: the god actually intervenes to save the hero. Particularly peculiar because elsewhere Crom only gives man life and will; everything else is up to the individual.
  • In Raymond E. Feist's Tear of the Gods, the bad guy, "Bear", kills a bar girl somewhere around chapter 2. Her boyfriend vows revenge. The rest of the book happens, and the good guys finally manage to corner Bear. Unfortunately, they are unable to kill him because he is literally invincible and super strong. Suddenly, the god of vengeance incarnates in boyfriend and strikes Bear down. Good guys return victorious.
  • Beginning with the novel Sahara, author Clive Cussler has often written his heroes into impossible situations, whereupon a minor character shows up and gives them the assistance they need to continue - a minor character by the name of Clive Cussler!
    • Granted, it's never an ENORMOUS Deus Ex Machina; usually just Cussler serving to get the plot back on the rails, usually by providing the heroes with direction or transportation. Also, the practice of Cussler writing himself into his books actually began with Dragon, though it wasn't until Sahara that he began interfering in an important way.
    • A lot of the ridiculous gadgets and technologies that can be accessed from anyone on earth and from anyone who owns them in a matter of hours is a bit of a consistent Deus Ex Machina. In Golden Buddha, for example, the Oregon is facing a couple of Chinese warships, so they just call in favors from an American submarine nearby that has on board a super-high-tech, top-secret missile that blasts a huge EMP to disable the warships.
    • The entire Oregon Files series centers around the ship which is nothing more than a giant floating Deus Ex Machina. Able to blow apart battle ships from various navies without blinking, a propulsion system that the second law of thermodynamics frowns at, armor that shrugs off almost anything thrown at it, a captain's barge that is essentially an Oregon Lite. It shows up just in the nick of time to save the away team or the captain's love of the week with just the right weapon to blow the bad guys to Davey Jones.
  • In Star Wars Galaxy Of Fear Hoole typically performs this role. Since he has the Story-Breaker Power of being able to mimic the shape and abilities of just about any creature in the Star Wars universe and thus would be able to quickly solve just about every problem the rest of the protagonists come up against with ease, he spends the vast majority of almost each book either incapacitated or doing his own thing off screen until showing up at the last second in some form or another to save the protagonists from something they otherwise would be dead meat if he didn't.
  • Greg Egan often uses characters motivated by religion (or other emotion-heavy ideology) to pop in, advance the plot by a sudden, violent action and never come back again. The most jarring example are the anachronauts from Schild's Ladder, who show up in the novel's climax to blow up the research ship. They are only mentioned twice before, never shown to have any specific agenda, and their actions have no lasting consequences beyond isolating the two main characters to continue exploration on their own.
  • Parodied to death and back in Suvi Kinos, where the little heroine's five uncles share a nom de plume and a serial story in a magazine which they write in turns. In a brotherly contest of wits, each uncle attempts to end their chapter in such a situation that the next in turn will have as much trouble as possible continuing. When the previous writer had left the story's heroine buried alive in a ridiculously secluded location, everyone was thrilled to read the next chapter, only to be let down with a blunt "after she managed to miraculously escape, she had tea under the pergola".
  • Played painfully straight in Goodkind's Sword of Truth: Richard Rahl's Gift (basically magic) qualifies. At the end of a book, expect him to know how to perfectly use it to get out of the dire situation of the week, while at the beginning of the next book he's so clueless about how to use it that the events of the last book might as well have not happened.
    • Lampshaded somewhat at the end of The Pillars of Creation when one character asks Richard why he even needs the Sword of Truth after seeing his magic shred an entire platoon. Richard explains that his gift seems to work out of anger and need, whereas the Sword works all the time.
    • Most notable in the eighth book, where Richard is dying from being poisoned, with the only antidote down the drain and the only person who can make the antidote dead. He then uses his Gift to reverse engineer the ingredients (down to the amount needed of each) of the antidote at the very last minute.
    • Also notable at the end of the fifth book, when Richard realizes how to stop the bells, using a leap of logic that is nothing short of mind-boggling.
    • Or the second book where Richard, without being aware he's doing anything of the sort, uses magical lightning to strike down all the enemy commanders and then any soldiers who don't surrender.
  • The Thirteen and a Half Lives of Captain Bluebear includes a "Mac", a "Roving reptilian rescuer" who flies around the world, rescuing people from certain death at just the last moment. His full name? Deus X. Machina.
  • In Bluebear, at various points Anagrom Ataf stands in the way of the Sharach-il-Allah, which leaves in accordance with rules of phenomena etiquette; some heavily lampshaded improbabilities with a dimensional hiatus save him from a gigantic Spiderwitch; and Professor Nightingale turns up on a cloud of pure darkness. Really, only Mac and Rumo the Wolpertinger weren't Deus Ex Machinae.
  • Jasper Fforde's The Well of Lost Plots — part of the Thursday Next series, which is dedicated to playing with literary devices — features a literal deus ex machina. It's a mysterious device given to all Jurisfiction agents in case of completely unstoppable disaster. At the end of the book, when a conspiracy that would have ruined all of fiction was coming to imminent fruition, Thursday activated the device and God came down and fixed everything.
  • In the Tortall Universe, the first Song of the Lioness book ends with Alanna defeating the enemy with an ability that she has a flashback to learning in the same scene that she uses it, but this is probably due to the edits Tamora Pierce had to do to the original manuscript.
  • Twilight: There are two main reasons in the first three books for why someone wouldn't want to be a vampire: first, the overwhelming desire for human blood, which is incredibly painful to resist, and second, a vampire's inability to reproduce. In Breaking Dawn, however all these concerns are swept away when it turns out that actually, only female vampires can't have babies—male vampires have magical sperm—and therefore Bella is able to have Edward's child by having sex with him before being turned. And after the half-vampire baby starts eating Bella up from the inside and Edward turns Bella in order to save her life, it turns out Bella isn't horribly tempted at all, with a weak attempt at explanation in the form of "Well, she chose to be turned." Actually, Breaking Dawn is crammed full of this. Bella whines for four books about being unable to survive without Jacob, her other prospective love interest, around, so in the fourth book he falls in love with her newborn baby and becomes part of her family, "where she always knew he belonged." Oh, and the big one: A group of powerful vampires, the Volturi are built up for three books as being the most powerful group of vampires around, but Bella's newborn vampire ability just happens to be able to completely defeat them without even a fight.
  • Averted in The War of the Worlds, where the Martians' complete lack of an immune system is stated outright by the narrator during a lengthy aside on Martian biology. It's a fact he states might have once seemed trivial, before going on to insinuate that Earth is essentially a Death World for them. This aside takes place at the midpoint of the narrative, well before the Martian onslaught shows any hints of decline. The first few paragraphs of the novel are even an extended Lampshade Hanging of the way it ends. Unfortunately this is a classic example of Adaptation Displacement due to these parts of the story routinely being left out of the far better known movies.
  • Warrior Cats: There are four instances in the first series where Firestar was about to be killed, but another character came by and killed/chased off whatever was threatening him almost instantly. Three of these four times, Graystripe was the one who saved the day.
    • The main reason Firestar was able to win his fight against Tigerstar in Forest of Secrets was because Tigerstar slipped on some blood.
    • For that matter, Brambleclaw picking up a wooden stake and twisting around just in time to impale Hawkfrost with it as he was about to deliver his killing blow at the end of Sunset seems a bit too convenient.
  • M.M. Buckner's titular Watermind survives everything the humans throw at it before being killed by contact with salt water. Okay, there was foreshadowing, but getting it would have taken someone who was both better at science (salt water being a better electrical conductor than fresh) and geography (the lake they were driving the Watermind into being a tidal basin) than the protagonists, which takes Viewers Are Geniuses to levels that would make Light Yagami throw up his hands in disgust.
  • Richard Adams' Watership Down has the rabbit protagonist saved by a human in one of the final chapters (appropriately named "dea ex machina"). Whether this is a true Deus Ex Machina is debatable, because the event is very logical from a human point of view, if not from a rabbit's.
    • The "dea ex machina" chapter title reveals a further pun when the human savior arrives in a car—seeming to the rabbit literally a "goddess in a machine."
    • A similar example comes earlier in the book, when the heroes cross train tracks safely, but their pursuers aren't so lucky. The rabbits take it for a literal Act of Frith (god), one unironically says something like, "You might think it's amazing to be saved by Frith, but it's really quite terrifying."
    • If you thought that was an example, you have no idea what Adams is capable of. The first print of his third book, The Plague Dogs ends as the notorious film does, and the exhausted, starved, broken dogs plunge into the sea ahead of their hunters, and swim out in the vain hope of finding an island they've convinced themselves lies just over the horizon. In all subsequent editions of the book, the reader persuades Adams to do an Ass Pull and he does: two of Adams friends come by in a boat (while having a conversation about Watership Down and anthropomorphism, no less) to pluck them from the sea and bring them back to the shore where the dogs owner (wounded instead of killed by the accident) is waiting.
  • In one novel in Harry Turtledove's Tales of the Fox series, the protagonists manage to trick the gods into solving the apparently impossible problem for them. Less of an outrageous example than most, as the main character tries to do this at least once in every novel in the series; this is just the only time it actually worked.
  • Zeus Is Dead: A Monstrously Inconvenient Adventure has several gods as main characters, so this trope is perhaps unavoidable, but it's also lampshaded: At one point, when Apollo saves Leif, Tracy, and Thalia (one of the nine Muses) from the Erinyes, Leif comments that he doesn't mind being on the receiving end of a deus ex machina. Thalia immediately laments the fact.
    Thalia: Oh, gods! And on top of everything, now we’re cliché!
  • In James Thurber's The 13 Clocks, when Prince Zorn and the Golux have brought the duke the jewels, he counts them: they are 999, not the 1,000 he had demanded. The Golux stares at his ring, and a diamond falls out. Which lets the duke gnarl about a Golux ex machina.
  • J. R. R. Tolkien occasionally uses Giant Eagles to whisk his heroes away from danger. These aren't just at the end of The Lord of the Rings, but show up in The Hobbit to rescue dwarves from burning trees that are surrounded by wolves, to tip the scales in the book's great battle, and in Rings to rescue Gandalf from the roof of the Tower of Orthanc as well. Tolkien seems to have been unable to resolve the issue of characters marooned on top of high things as well as unable to resist putting them there. Whether these are a Deus Ex Machina is often debated:
    • Tolkien called them a dangerous machine that he dared not use often with credibility. He thought them a deus ex machina, though in the books he justified them better.
    • The Eagles are Manwë's messengers, so this is a legitimate case of a true Deus Ex Machina.
    • Bored of the Rings had one of them stamped with "Deus Ex Machina Airlines."
    • Common objections: The Eagles' place in Middle-Earth's greater cosmology that's All There in the Manual, Gandalf being a wizard and getting this sort of thing as a perk, defining Deus Ex Machina to play a crucial role in the quest when, in Rings, the quest was completed on the main characters' own power and getting out of Mordor alive was no part of it.
    • What's most irritating about the Giant Eagles is that they raise serious questions about the story's foundations.
      • As lots of people have pointed out however, the eagles would be easier seen by the Eye of Sauron, his Nazgul are riding winged beasts and as Tolkien writes eagles aren't always nice there is the possibility the ring could corrupt them.
    • Throughout The Silmarillion various characters are, like in LOTR, saved from almost certain death by a convenient Eagle, although here there is the explanation of it being literal; the Vala Ulmo (basically a god) teamed up with the Eagle Thorondor to aid the people of Beleriand against Morgoth, but due to the rest of the Valar shunning Beleriand Ulmo can only intervene in limited ways. Most of the novel is spent detailing the hopeless wars of the Elves and Men against Morgoth's forces. Conveniently the Valar then arrive to defeat Morgoth in time for the end.
    • All of these are justified by the fact that Tolkien's works are intended to be a mythology; gods really do exist and intervene in the affairs of the world to achieve their desired results just like in Greek, Norse or any other mythology. Indeed, the Valar (the 'gods') intervene progressively less as time goes on, so that by the time of Lord of the Rings, they've limited themselves to simply giving the protagonists an indirect nudge in the right direction.
    • Also probably intentional, given Tolkien's own religious views. The mortals (Elves, Men, and Dwarves) tried to beat Morgoth) and failed. It took divine intervention to pull it off, fitting in with Christianity.
    • The Istari (Wizards) themselves were slightly this, appearing about the time Sauron was starting to regain power. Jusified, the Valar couldn't directly intervene, so they send 5 Maia in human form to help rally the peoples of Middle-Earth against Sauron. This doesn't entirely work, as the greatest of the Wizards ends up joining Sauron, but ultimately it pays off due to Gandalf. What happened to the other wizards is another question…
  • Stephen King
    • The Dark Tower series, which relied upon the conceit that King himself was authoring the events as they took place, includes several instances in which King throws a bone to the characters to get them out of a sticky situation. In one Lampshade Hanging moment, a character finds a note from King reading "DON'T WORRY; HERE COMES THE DEUS EX MACHINA!"
    • The Stand, which inspired a limerick:
      Oh, the Superflu caused so much pain, oh!
      And with evil a raging volcano
      Flagg's triumph seemed certain
      Until King rang the curtain
      By pulling a Deus ex ano!
    • Discussed in Misery with reference to a Cliffhanger Copout. When Annie forces him to write another novel in a series he had ended by killing the protagonist, Paul Sheldon is forced to write a continuation that isn't one of these. The story references that Annie is familiar with, and hates this trope, and Paul needs to write the character back to life in a way that makes sense. He manages to cheat a little with Not Quite Dead, but the story ends up better for it.
  • One Rainbow Magic book had this. In Danielle the Daisy Fairy's book, the girls are completely incapable of retrieving the flower petal and are saved by a girl who happened to see what was going on.
  • How many fairy tales have one of these? In multiple versions of "Snow White" and "Sleeping Beauty" (their Disney versions being huge exceptions), the prince never appears until the end to perform his heroic deed. Rapunzel's tears cure the prince's blindness. A hunter just happens to walk by Grandma's house as the wolf is attacking Little Red Riding Hood. Although it occurs midway in the story, there is also Cinderella's fairy godmother.
  • Both of the The Cat in the Hat books by Dr. Seuss arguably feature a Deus Ex Machina ending. In the first book, after the Cat, Thing One and Thing Two have made a complete mess of Sally and her brother's house and with their mother nearly home, the Cat suddenly comes in with a machine that picks everything up. And in the second book, after the Cat has turned the entire house (and snow surrounding it) pink, and his miniature Cats A-Y are unable to clean up the mess, he introduces one last Cat Z with a magical power called "Voom" that miraculously turns everything back to normal.
  • In Desert And Wilderness: Nel is dying of malaria in the middle of Darkest Africa. Staś, who has no chinine and no hope left, suddenly notices a suspicious plume of smoke which he decides to check. It's the campfire of Linde's expedition, which has medicine, tea and plenty of other stuff to spare.
  • The novel Temple has a character on a tank falling from a plane, with no parachute at all. He survives because he was wearing a jetpack. That he didn't know about. That was mentioned in passing once before. That was never mentioned by a character who supplied it to him and obviously should have known.
  • H.P. Lovecraft of all people pulls one at the end of Dream-Quest of Unknown Kadath, when hunting horrors, which was send to catch main character, was suddently waporised by Elder god Nodens, who never appeared in that story and barely have anything to do with it.
  • In the Nancy Drew book "The Sinister Omen", the villains are members of a massive stamp stealing syndicate. In the final couple of pages, the villains successfully elude Nancy Drew, and board a plane to escape. The plane is about to take off...then gets swallowed up by a sinkhole. At no point in the book were sinkholes mentioned before that moment. The villains are then easily arrested. End of book.
  • Invoked purposefully in The Hunger Games. If a tribute appeals enough to the cameras, they gain "sponsors", who can send them in supplies from a parachute. Katniss and Peeta utilize this by faking a romance for the cameras. The Capitol loves something to gossip and swoon over, so the two of them become celebrities as much as tributes. Also, Katniss could easily kill Cato with her bow, but he's wearing a sort of skintight body armor from a sponsor, so she can't. But the Capitol likes to put on a good show, and so the Gamemakers let loose a pack of genetically engineered wolves as a sort of "grand finale", and Katniss and Peeta manage to manipulate them to all but kill Cato. The wolves kill him slowly, because, again, the Capitol loves a good show. And in a previous Games, a 14-year old Finnick Odair didn't even do anything and yet was showered with sponsors, all because he was so ridiculously physically attractive. Finally they sent him a Game-Breaker weapon — a trident, one of the most expensive gifts a sponsor ever gave — and since he had grown up using tridents and harpoons to fish, he offed the rest of the competitors with ease.
  • Arc Of Fire: Myrren figures out exactly how to use magic in activating the Dark Heart just when she needs to, sacrificing her life in the process. It works, Kyrian's defeated, and she's brought back from the dead too.
  • The Mysterious Island has several, many of which are major spoilers and the least of which is a chest containing a selection of tools seemingly packed specifically for castaways with little hope of rescue. In a shining example of Tropes Are Not Bad, these interventions always raise questions, and drive more than one character to near insanity obsessing over what is causing these things to happen.

http://tvtropes.org/pmwiki/pmwiki.php/DeusExMachina/Literature