Deus Ex Machina

""That certainly is convenient.""

- Tyrone, The Backyardigans, (frequently)

A common form of Ass Pull or Writer Cop Out, a Deus Ex Machina is an outside force that solves a seemingly unsolvable problem in an extremely unlikely (and, usually, anticlimactic) way. If the secret documents are in Russian, one of the spies suddenly reveals that they learned the language. If the writers have just lost funding, a millionaire suddenly arrives, announces an interest in their movie, and offers all the finances they need to make it. If The Hero is dangling at the edge of a cliff with a villain stepping on his fingers, a flying robot suddenly appears to save him.

The term is Latin for god out of the machine (pronunciation: Day-oos eks MAH-kee-nah) and has its origins in ancient Greek theater. It refers to situations in which a crane (machine) was used to lower actors or statues playing a god or gods (deus) onto the stage to set things right, often near the end of the play. It has since come to be used as a general term for any event in which a seemingly fatal plot twist is resolved by an event never foreshadowed or set up.

There are four primary forms a Deus Ex Machina can take:
 * 1) Total Deus Ex Machina -- A plot element that didn't previously exist and has no logical explanation behind it. Let's say the hero has been pummeled to an inch of his life and the villain has regained control of his gun. The hero then finds a magical remote control under a nearby couch that allows him to pause the scene, take the gun away, and shoot the villain.
 * 2) Illogical placement and timing Deus Ex Machina -- When something is established and explained in the work, but its use in that situation is jarring and impossible to believe. Building from the example above, let's say that instead of a magical remote, the local militia bursts in and shoots the villain. Maybe it was established earlier that the militia protects the countryside, but for them to somehow divinely know that there is a fight going on at this isolated farm and to burst in just in time to save the day is a Deus Ex Machina.
 * 3) Cut and paste Deus Ex Machina -- When Chekhov's Gun is quick-drawn, but it's done in a clumsy way that makes one realize that the author obviously just couldn't write them out of the situation with what they have, so they went back to some earlier point and put in one or two throwaway lines to set up a victory down the road. From the example above, perhaps the hero randomly decided to put a tiny pistol in one of his pockets and just happened to forget that he had it until now.
 * 4) Fridge Brilliance -- When something seems to be a Deus Ex Machina, but really isn't. The writers were just a bit too clever for their own good. To build from the above, let's say that in some early scene the hero intentionally rigged his gun to blow up should it ever be fired and it both fits with his personality and seems like a logical thing he would do. It might seem like a cop-out at first, but one then remembers he's a Technical Pacifist who Doesn't Like Guns and never wants to fire one in his life in spite of his job. See also Chekhov's Gun.

Note that the Romans and Greeks used type 1 and 2. This was mainly due to tradition; unlike today, audiences in ancient times were openly violently hostile to excessive innovation to the point that they would break out in riots if a writer tried to go too far. Some moderns assume, wrongly, that true art sticks it to the man and always has, and crow that ancient writers were cowed by "royalty" not to be controversial. In reality theatric performances were staged by the aediles, minor elected officials who didn't have the authority to arrest anyone. The Emperors (when they did arise -- for most of this time period Rome was a republic and had no royalty) treated theatre as if it were beneath their notice -- in fact, the only theatre person to get in serious trouble did so after cuckolding the Emperor (plus Nero, who thought he was a theater person and got in trouble for unrelated reasons).

The lines between Deus Ex Machina and other devices are thin and blurry. If the villain above suddenly falls a victim to an offscreen sniper's shot without any plot connections it would likely be type 2: Big Bad is likely to have foes, but here's a Contrived Coincidence. If this sniper turns out to be some long-forgotten Victim Of The Week or a relative, it's type 3. If one of hero's potential allies did refuse to participate in the action, but decided to act on his own and it's in character, it may be type 4. If the villain was earlier attacked by some enemies, lurked in his lair with tight security, but then went out of his way to punish the hero and made a good target of himself by posturing and gloating in the open, it's not even Chekhov's Gun, just a death by carelessness.

In the early years of the film industry, however, the concept came back into vogue due to the Hays Code. Villains, and anyone else who didn't toe the moral line, were absolutely not allowed to get away with their crimes, but as everyone knows, Evil is Cool. The solution was to let them be awesome for the duration of the movie, then drop a bridge on them in the last five minutes. It worked, of course.

In spite of the above, even the dreaded Deus Ex Machina - perhaps the most notorious of tropes among readers, beating out Mary Sue - can be pulled off. There are ways to have a Deus Ex Machina resolution and still come to a satisfying conclusion - see the entire "Rule Of X" series of tropes: Rule of Cool, Rule of Cute, Rule of Empathy, Rule of Fun, Rule of Funny, Rule of Romantic, Rule of Scary, Rule of Sexy (for those ever-so-fun Deus Sex Machinas), Rule of Symbolism, and especially Rule of Drama. The key word, of course, is "satisfying." It's definitely more difficult to achieve with some Rules than with others but not impossible for any of them.

As noted below, this happens plenty in real life. Of course, Real Life is a much more complex system than most fictionalized versions of it, and so this ends up a legitimate plot twist. Fiction is also limited by the Law of Conservation of Detail, while real life clearly is not.

The Reset Button often depends on Deus Ex Machina. A subtrope of Ass Pull; see also Diabolus Ex Machina. Particular types of deus ex machina include Coincidental Broadcast, You Didn't Ask, and often, Eureka Moment. Sometimes lead to a Gainax Ending. Also consider Suspiciously Specific Sermon for deus ex machinas that are actually religiously related.

The word Deus ex Machina is also taken literally as a term for making ourselves gods through the application of technology, e.g. The Singularity; this isn't what it means at all! (Not that it wasn't a clever attempt at wordplay in the titles of the cult PC video game classic Deus Ex, its sequels, the unrelated manga Deus Ex Machina, or the trope Deus Est Machina).

Warning: Ending SPOILERS below.

Also also, '''please make sure you have read the above criteria BEFORE submitting an entry. This is a not a place to Complain About Plot Twists You Don't Like.'''

Anime and Manga
"Yami Yugi: I activate "Deus Ex Machina"!
 * Bleach has so many examples it's hard to list, for the sake of space, probably the worst/ most blatant instance:
 * The much reviled and oft-mentioned moment of Ichigo being able to go full Hollow is often accused of being this, but it ultimately did make sense. It wasn't good writing, but it was foreshadowed a number of times.  is the true deus ex machina, because of New Powers As the Plot Demands. Having proven to be increasingly invincible against the strongest members of the cast, Ichigo scores a new, never before mentioned power, and utterly destroys him.
 * Played absolutely straight in Slayers NEXT. Nearly the entire plot revolves around Lina's refusal to cast the Giga Slave after her discovery that miscasting it may end the world. Hellmaster Phibrizo eventually blackmails Lina into casting it and ensures that the casting fails, only for the power called upon by the spell, the supreme creator goddess of the Slayers universe, the Lord of Nightmares, to take Lina's body as an avatar instead and promptly annihilate the previously invincible (to the heroes) demon lord with a casual gesture. She also plays Reset Button by bringing everyone back to life that Phibrizzo had killed (Lina's breaking point about casting the spell was his threat to obliterate their souls as well).
 * Not only Justified and foreshadowed just enough to turn the event from a cop-out to a Crowning Moment of Awesome, but implications of The Reveal cast the whole series in a very different light.
 * The final episode of the Angel Sanctuary OVA is about as literal an example of this trope as it gets.
 * Outlaw Star featured something known as the Galactic Leyline as the main driving point for the entire series. It turns out that the leyline is an almost literal translation of deus ex machina. It's a extremely complex spaceship that collided with the center of creation creating a being that can manipulate time, reality, perception and essentially grant whoever approaches it anything they wish. It is literally a god created from a machine.
 * Pokémon loves and thrives on this, and many seemingly unwinnable situations are weaseled their way out of by Arceus Ex Machina.
 * The second involves a situation involving a showdown between Team Rocket and "the twerps" where either Team Rocket seems to have the upper hand or the two sides have been forced into a dangerous stalemate. Cue a single, recurring Pokémon, typically either Marker-Jigglypuff or Misty's Togepi. The former will sing their soothing music and cause everyone to fall asleep (thus enraging it and causing it to doodle vengefully on everyone), or the latter will start using the metronome attack, which causes a burst of random Deus Ex Machina energy to fill the room and set everything right.
 * May's Skitty has the Assist technique, which randomly uses an attack known by another member of the party. Of course, it naturally has the Random Number God on its side.
 * She got better about it, and later seemed to use it as a jumpoff for improvisation than a lucky shot. One contest had her focusing on keeping Skitty alive while spamming Assist continually, producing effects varying from mildly useful to downright inhibitive, until she got the attack she wanted in the first place and oneshot the opponent.
 * The most ridiculous example is at the end of the ninth movie. Everyone had evacuated the flooding Sea Temple as Ash was trying desperately to fix the Sea Crown that the Big Bad had tried to steal. The temple rises to the surface of the water, but Ash doesn't come out. Everyone thinks he drowned and starts crying, and Phantom takes advantage of the moment to grab Manaphy and make his getaway. It would've worked, except at that moment, Ash bursts out of the water, surrounded by glowing golden light, and flies through the air to save Manaphy.
 * It was explained (in the tag scene) as a function of the Sea Temple, but wasn't really adequately foreshadowed (to put it kindly).
 * There was one episode where Team Rocket grabs Pikachu and flies off in their balloon. How does Ash get him back? He jumps five stories straight up into the balloon basket, with no assistance from any nearby plot devices. It looked exactly as ridiculous as it sounds.
 * The Pokémon the First Movie features Ash running between a beam struggle between Mew and Mewtwo that turns him to stone. When a few shocks from Pikachu make it clear that Ash is, in fact, dead, all of the Pokémon cry... and their tears swirl over to Ash's body and bring him back to life. Nowhere else in the entire series is the fact that Ash was literally brought back to life brought up.
 * This was actually foreshadowed earlier in the movie.
 * In the Pokémon Special manga, Ruby can't penetrate through the lightning that a machine made to be able to defeat the Big Bads. What does he do? The only logical thing, of course, call out which, doesn't make sense because  isn't more resistant to electricity than Swampert, but that's not all. Then  proceeds to use its
 * There's a subversion in the Ash vs. Paul full battle by Lake Acuity. Even though Ash's Chimchar evolves into Monferno after beating Paul's Ursaring, it's unable to beat his Electabuzz. Though even if it had been able to, Ash would've lost eventually because Paul still would have had three Pokémon left.
 * What may be the most ridiculous was Ash's battle against Tate and Liza, where Ash's Pikachu and Swellow, the last of which was at a disadvantage against their Lunatone and Solrock, inexplicably pulled out the infamous golden "lightning armor" gambit and knocked their opponents out.
 * And how about the one that started them all - Pikachu defeating Brock's Onix because he Thunderbolts it while the sprinkler system is running!
 * This could make sense given the typing and such, but where it loses all sense is the fact that there were sprinklers in a Rock-type gym. It makes you wonder why Brock would install sprinklers when his Pokemon are weak to what comes out of them and there doesn't look to be anything particularly flammable inside anyway. Perhaps one of the Brocklings enjoys playing with matches or some such.
 * Batou is saved from certain death in Ghost in The Shell Stand Alone Complex by an extraordinary literal example.
 * The heroes in Yu-Gi-Oh seem to win solely on pulling the one card out of a forty card plus deck that can save them from doom. Many times, these cards are not alluded to prior to their save the world moment and turn the tide of the battle completely 180 degrees. After all, how many times have you heard the line "It all comes down to this one card" only to have them draw a complete waste of a card?

Weevil: (Beavis-esque voice) Hee hee! Hey! No fair! You can't use spell cards on my turn!

Yami Yugi: Tell it to the writing staff!!"


 * In the manga version of the story, this is actually Yami Yugi's superpower. Which of course says nothing about the fact that other characters pull the same stunt.
 * Taken to its logical extreme at the end of the battle against Noah. Yugi's hand is empty, but on his final turn, he manages to draw a card that lets him If not for the Power of Friendship scene just before, that draw would have been ridiculous even by Yu-Gi-Oh standards.
 * Taken even further in the duel against Leon in the filler tournament arc. Thanks to the Big Bad hacking the game system, Leon's Golden Castle of Stromberg forced Yugi to throw out half his deck at the beginning of every turn. This continued until Yugi only had one card left in his deck. This card allowed him to destroy all of Leon's monsters and all of his life points at the same time.
 * In the last duel of the Battle City Final Yugi plays Ragnarok, a previously unseen card, which allows his entire cast of monsters to pulverize the Winged Dragon of Ra, and leaving Dark Magician and Dark Magician Girl on the field. The card was never played or mentioned again.
 * All of the Millennium Items seem to have a bunch of random powers that either activate by themselves, or the characters remember just in time. Of course those powers are never used again. For example, in one episode, Yami uses the power of the Millennium Puzzle to force the spirit of the Millennium Ring into the Duel Monster card he trapped Bakura in, and restored Bakura to his body.
 * In Seasons 2 and 3, Marik's Millennium Rod likes showing Kaiba visions, since Kaiba owned the Rod in a past life. When Marik orders the Rod to show him those same visions, it doesn't obey him.
 * Some episodes attempt to justify this by having characters note they need the right card to turn the duel around, but they don't get it for several turns and they have to stall. And there are only 40-45 cards in the decks, if you stall long enough you'll draw what you need sooner or later.
 * Speaking of Yu-Gi-Oh, the card "Miracle Tuner - Savior Dragon" ("Majestic Dragon" in the dub) from 5Ds has earned the nickname "Deus Ex Machina Dragon" within the fanbase, as it's a card that appears in a character's deck when the Crimson Dragon (our resident God for this series) wants it to. Not only that, but it allows whichever character that uses it to summon another monster that isn't actually in their Deck (well, Extra Deck technically, but still).
 * Sonic X has one of these in the finale of its final season, where the stone Cosmo has been wearing since the beginning of the series is revealed to be a magical amulet that can automatically accelerate her growth so that she reaches the stage of becoming a tree (as is apparently the fate of all her species) early, attaches herself to the bad guy and weaken him so that the Good Guys can shoot and destroy. We had heard pretty much nothing about this earlier in the series.
 * Said stone MAY only be magical by default, depending on whether you believe the dubbing. Previously ALL seedrians were seen to be wearing a similar stone, so it might just be a general species thing. Either way it was still kind of an Asspull.
 * According to the original Japanese version (with English subs), the stones prevent Cosmo's kind from transforming into their final form (which saps all their energy and leads to death) - males' final form are powerful dinosaur-like plant monsters; while females just turn into trees that can reproduce. This was explained several episodes before the finale episode in Japanese (which would probably still qualify it for this); but the English dub didn't explain it at all.
 * Occurs in all three installments of the Transformers Unicron Trilogy trilogy; at some point the Autobots are defeated and critically damaged, but then they are repaired and upgraded(and in the third installment given new vehicle modes), by the Minicons in Armada, then by Primus in Energon and Cybertron.
 * In an earlier series, this is what saved Star Saber from Deathsaurus in Transformers Victory. Deathsaurus delivers a vicious, merciless beatdown, driving Star Saber to the point of deactivation. He's about to deliver the final blow when his living metal-destroying cannon...runs out of batteries.
 * Another example comes from Transformers Zone: Metrotitan is devastating Earth with a freeze gun, and Dai Atlas and Sonic Bomber are for some reason powerless to stop him. All of a sudden, Road Fire appear, with a heat ray that's just the thing to revert Metrotitan's effects, and then proceeds to single-handedly kick Metrotitan's retrocharger.
 * Eureka Seven grants us the wonderful moment where the protagonist magically creates a new, super-powerful unit out of thin air by the !
 * Note: this is very likely true. Also note that it's not nearly as bad as it sounds because this series takes The Power of Love and runs with it.
 * There is some Fridge Brilliance to be had here, too. Considering that the Scub Coral was in the process of awakening (which would ultimately cause reality to unravel) and given the link between the coral and the giant mech itself, it is reasonable to think that some new powers would become available.
 * Everything happens for a reason. It's fated that Renton and Eureka will be with each other; that's probably why this happens. Look at the movie version, Eureka
 * In Naruto, Sasuke pulls off a No One Could Survive That by when he's completely out of chakra. Said technique is difficult because of the huge amount of chakra required.
 * Not to mention he pulled this all off in the time it took for an explosion that would completely level a city to reach him. After the explosion had already started. When it started just a few feet from him. Great Snake Escape, indeed.
 * Chapter 449: After spending the last thirty chapters wreaking havoc.
 * During his assault on the Kage Summit,  nearly died from chakra exhaustion, having been spamming the crap out of high level techs with his new  . And then, out of nowhere,
 * Anyone who gets their tailed beast exorcised from them will die ater the extraction, but not
 * S-Cry-ed had an episode in which Ayase was battling Kazuma. While fighting, she had a heart monitor reading her brother's life signs. However, when her bro kicks the bucket, she throws the fight and somehow loses the will to live and just dies.
 * Her repeated refining left her body a complete wreck, and her only reason for living/fighting was so that her sick brother could get treatment.
 * This still doesn't justify her death, as she was still in perfect shape to keep fighting Kazuma, then just * dies* when he kicks.
 * Although it's not quite justified (Since her brother died while they were fighting) it IS established that motivation is the only thing that keeps super-alter users alive. She also didn't WANT to fight Kazuma, so I guess she also felt sorry for what she was doing to him.
 * A major sticking point with fans at the end of Part 3 of Jo Jos Bizarre Adventure is Jotaro's  in his fight with Dio, which enables Jotaro to fight Dio on more or less equal terms. The only possible foreshadowing of this is Dio's comment that he and Jotaro share a similar type of Stand, but Dio is just as shocked as the reader when Jotaro is able to.
 * This could be a case of Fridge Brilliance, as a connection to the Joestars' stands was established early on. In his first Part 3 appearance, he was seen using Joseph's stand powers. Since he's never seen using Joseph's clairvoyance again, the whole purpose of the scene seems to have been foreshadowing.
 * Another one comes at the end of Part 5, when Giorno fights Diavolo. Giorno is, and his Stand Gold Experience gains the ability to   Stands had been shown to develop new abilities thanks to the arrow before, but that power is ridiculously broken.
 * A borderline case appears in the second season of Gundam 00: with the forces of about to be defeated,, fan opinion is divided as to how much of a Deus Ex this is, if at all, and if so, whether it qualifies as an old school Greco-Roman Deus Ex, or the Fridge Brilliance variety.
 * Gundam 00 practically spammed Deus Ex Machina from beginning to end. Almost every time Celestial Being came even remotely close to defeat, A.) one or more of the Gundam Meisters would reveal a weapon or a feature that was previously not shown nor hinted at before, such as the case of the Nadleeh and later its Trial System or B.) be saved by the intervention of an outside force like the Thrones or C.) one of old man Aeolia's little hidden features (i.e. Trans Am) would trigger, essentially a more grandiose version of A. This was especially insulting for their opposition, who would make painfully detailed strategies that exploited the Gundams' (known) weaknesses and would have otherwise been successful until Deus Ex Machina kicked in.
 * In Asatte no Houkou, Karada and Shokou are able to  when, which she had never previously mentioned or hinted at having. This, of course, didn't happen in the manga.
 * Star Blazers (Comet Empire War); The near-Godlike Treleina of Telezart turns up at the very last moment to Possibly partially subverted as Captain Wildstar had already begun the process of  to achieve the same end.
 * A literal Deus Ex Machina is attributed to everyone's survival after the Final Battle of Rave Master. This despite several characters using a Dangerous Forbidden Technique to win their battles. The characters theorize that since they saved the world, the world decided to save them back.
 * Gurren Lagann did this over and over... sort of. Essentially a "logical" Deus Ex Machina was set up for the shows entirety with Spiral Energy, literally giving characters the ability to do the impossible through their, sheer willpower and greatness. On paper it sounds like an extreme Deus Ex Machina, but when watching/reading it it's exciting and used enough to not feel like the giant cop out it may first appear.
 * Gainax being Gainax, they then hang a lampshade in the last act of the anime that is summated "using Spiral Energy too much will destroy the universe" (read: "using a Deus Ex Machina too often can ruin a series"). That's cheeky.
 * Mic Sounders of Gao Gai Gar is arguably a walking Deus Ex Machina. His Disk P Theme Music Power Up powers up (and seemingly to a small degree repairs) all of the heroes within earshot (and is also continually used throughout the series). Disk M can disable mechanical systems in only the bad guys (it?s ability to selectively deactivate the bad guys system is in itself somewhat deus ex machina-y). On the much more dangerous side he has his disk x which destroys things at the molecular level, meaning there is literally nothing it cannot destroy and the even more powerful disk F which  to destroy anything in his path. Basically if Mic were to ever receive a major upgrade, much like some of the other mechas receive, then he would render GGG totally obsolete since the only step up from Disk X and F is a disk that completely controls the very fabric of reality.
 * A staple of the Sailor Moon anime. Two notable instances would be all the heroines dying only to be randomly resurrected; and our heroine throwing herself from a floating island, then inexplicably sprouting wings on the way down.
 * Not quite. Usagi didn't sprout wings, she turned into her Princess form in mid-fall and caught up with Sailor Chibi Moon, who'd been thrown off the aforementioned platform shortly before Usagi jumped off herself. Moon then woke Chibi up, Chibi used Twinkle Yell, and Pegasus came swooping in for a Diving Save just before they turned into a big magical smear on the pavement. And the aforementioned resurrection was a result of Usagi wishing on the Silver Crystal, something Queen Serenity pulled off in the backstory (this was shown in a flashback episode several episodes prior to its' usage in the first season finale).
 * Mahou Sensei Negima: Halfway through the Gecko Ending of the first anime, after.
 * This deserves a special note; the  in question was a major plot device in the manga's Mahora Festival arc. While it was a major Ass Pull for those who only watched the anime, for those fans familiar with the manga it was somewhat closer to a Continuity Nod.
 * Another example is the end of the Kyoto Arc, where the Negi party was saved from the Big Bad and the Demon God he unsealed by the equally demonic unsealed Evangeline.
 * However, she coming to the rescue was foreshadowed, at last in the manga.
 * Played straight (and literally) in the last few volumes of the Fushigi Yugi manga. Taka buys Miaka a pager.
 * In Initial D, when Takumi battles the Todo School's rally driver with the School's demo car at Happogahara, he is absolutely going to lose
 * The Rozen Maiden manga was Cut Short by LaPlace announcing that the Alice Game of that era had come to an end, leaving all the action that currently was building up gone by a bloody rabbit deciding that the game will not continue within the very timeframe of the story, inevitably leading some fans to believe that they will never find out who wins. However, with the reboot of the manga and the "tales" being released on a monthly basis, this theory is thrown out the window, since the same dolls now appear in an alternate timeline in which Jun chose not to wind up Shinku. Indeed, it is too revealed that it wasn't so much of a Deus Ex Machina as simply LaPlace speaking in riddles, as he usually does. Indeed, the events of the original timeline did, in fact, happen, and the two timelines are revealed to actually be connected.
 * The Rozen Maiden anime's second season, Traumend, also ends with a major Deus Ex Machina.
 * Not all.
 * At the end of Wolfs Rain,  This comes off as a bit of an Ass Pull for some.
 * ...those who paid attention, however, remembered that  No, the real Ass Pull is
 * Somewhat lampshaded in Hellsing where the giant zeppelin of the Magnificent Bastard Major is called the Deus Ex Machina- appropriate seen as how it appears from nowhere to bomb London.
 * Gensomaden Saiyuki: When outnumbered in a deadly pinch, Goku's diadem will break and he transforms into the Seiten Taisai. After kicking everyone's ass, he turns on his own friends until Kanzeon Bosatsu shows up and places a new diadem on his head.
 * In Dragonball Z, when Frieza is revived and comes to destroy the Earth, everyone is crapping their pants because Goku was "the only one" who had a chance at beating him. Then, out of nowhere, Trunks appears, killing Frieza with a few slashes, then King Cold shortly after. Yes, Frieza was a way of giving the Z Fighters' newest ally his big introduction to set up the Android/Cell sagas, but that doesn't keep him from looking like something out of a bad fanfic.
 * Arguably, Trunks killing Frieza was of little consequence, since Goku arrives not long afterwards and it was Frieza's plan from the start to wait for Goku to arrive before destroying the planet. The very existence of Trunks's future implies that Frieza had little time to terrorize the Earth before Goku arrived and defeated him. Perhaps a better example of Deus Ex Machina in Dragon Ball Z happens in the movies. In order to beat powerful enemies like Lord Slug and Broly, the Z Fighters transfer their power to Goku, which gives the latter a tremendous boost in strength, more than enough to destroy the enemy in a dominating fashion. Said ability is never elaborated (at least not to that extent) in the main series, where it would have no doubt made some of the biggest fights a lot simpler.
 * Detective Conan, Conan can do anything at given times from riding a motor boat, a helicopter, and shooting guns with a common excuse of "My dad thought me that in Hawaii."
 * In Yu Yu Hakusho, Yusuke winning Genkai's tournament could apply. Ignoring the fact he was lucky enough to have Kibano tell him about his helmet, the edited Dub Induced Plot Hole qualifies because it removed the cigarette that led to his victory. Kazemaru lost because the throwing stars locked on to his energy at the same time Yusuke slipped into the mud; Genkai acknowledged that victory was a fluke. Rando attempts to shrink Yusuke the same way he did to Kuwabara, but it backfires. Genkai explains that a chant will do so if it can't be heard by the victim and it turns out at that moment Yusuke had algae in his ear.
 * There's also Hei deciding to help just as Sniper blows up the truck.
 * Brilliantly justified and subverted in Puella Magi Madoka Magica. At first, it would seem completely coincidental how Homura seemed to arrive on the screen to save the day it seemed, as well as extremely unlikely.
 * In Cardcaptor Sakura, The Power of Love proves itself to be quite this trope. At the end of the TV series, Sakura accidentally ends up creating a new nameless Card when her powers react spontaneously to her tears at Syaoran's departure. At first glance it appears to be a Sequel Hook, but fast forward to the end of the Sealed Card movie, where at the last moment, it negates the Void Card's power and combines with it to form the Hope card, protecting Syaoran from losing his love for Sakura and allows it to be captured, restoring everything (and everyone) back to normal.
 * And another one is when Sakura encounters the illusion card, which, on the date of her dead mother's birthday, adopts her form, and thus lures Sakura into falling off a cliff. Before hitting the ground nonetheless a translucid hand (that of her real mom) appears out of nowhere and slows down her fall. And as a backup Deus Ex Machina Yukito just happened to be passing by at that precise moment to come and catch her.

Comic Books
"Scott Pilgrim - "I can't even get near him! I need some kind of... like... last minute, poorly-set-up Deus Ex Machina!!""
 * Lampshaded word for word in the Spider-Man comic "Reign", where an old-ified Spidey is saved from the now-registered-heroes Sinister Six, having been sicced on him by Venom in the first place (LONG story, and It Makes Sense in Context), by the disembodied tentacles of the long-dead Doctor Octopus.
 * The Marvel Character, The Sentry, is so powerful (he had to create a nemesis from his own being in order to counter balance his abilities), that formal story arcs are no longer written about him. Instead, he is used as a "hero" ex machina, bursting in at the critical moment to save other Marvel characters. He is brilliant in that he is an in universe hero, who some would argue is expected to be there to save the day.
 * Batman often solves situations by just happening to have a gadget on hand.
 * "Hand me down the shark repellent Bat-Spray!"
 * On the TV series, anti-[fill-in-the-blank] pills were commonplace, including Anti-Penguin-Gas (taken before attending a town hall meeting held by The Penguin) and Anti-Hypnosis (to block the effect of The Joker's hypnotic music box) pills.
 * Back when he killed people, Batman once confronted a Doctor Doom (No, not that Dr. Doom ) who threw a grenade at him. Batman then shields his and Robin's body with...this. It's not even a frickin' gadget!
 * The titular character of The Adventures of Tintin was saved many, many times by a Deus Ex Machina. To the point where he really should look into playing the lottery.
 * Tintin In America alone must have set some kind of record:
 * Tintin is dropped into a room full of toxic gas, collapses and is thrown in the lake:
 * Tintin and Snowy fall off a cliff:
 * Tintin is Chained to A Railway: he is saved when As the newspaper headlines put it: "MIRACULOUS ESCAPE!"
 * The Dragon uses explosives to create an avalanche on the cliff Tintin is climbing: This one is a bit milder, but a few pages later:
 * Tintin is dropped into an industrial meat grinder: the oblivious factory workers
 * Tintin has weights tied to his feet and is thrown in the lake:
 * Taken to new heights in Flight 714 where after a dastardly hijack-revenge plot, Tintin and Co. are saved by
 * This is probably a good time to point out that serials like Tintin often use deus ex machina because nearly every installment ends with a cliffhanger meant to keep the readers interested in the story. Too keep the plot going, these moments of tension need to be resolved quickly.
 * The Flemish comic series Spike & Suzy has as one of the main characters Jethro, an unbeatable modernized cave-man. He often drops in at the end of the adventure, often literally ex machina, being dropped off by a plane or by some kind of Applied Phlebotinum to solve the situation the heroes are stuck in.
 * The Sam and Max Freelance Police comics by Steve Purcell have had the titular characters narrowly avoiding death using Deus Ex Machina on several occasions for comedic effect. In the very first story, Max is saved from ritual sacrifice when the guy holding the dagger spontaneously combusts.
 * And don't forget Sergeant Blip and the Rubber Pants Commandos, they are almost a Deus Ex Machina incarnated; They only appear to save Sam & Max of whathever. Almost every time without an explanation.
 * Taken to the extreme in the Hit the Road comic that the Lucasarts game was based on. Sam and Max narrowly avoid being dunked in scalding hot wax by nefarious pirates by Ratso, Sam and Max' octopus pal
 * Brutally and hilariously parodied in the third volume of Scott Pilgrim (even more hilarious when you realize it was actually a Chekhov's Gun):

"Dr Manhattan: Now, I believe we have a conversation scheduled.
 * Utterly lampshaded in Fables spinoff Jack of Fables, whose characters include the Literals, Anthropomorphic Personifications of literary devices. Just as Jack is about to be killed by the Knife-Johns with no apparent way out, Dex - the AP of the Deus Ex Machina - turns up out of nowhere and proclaims that the Knife-Johns all unexpectedly died of instant pneumonia. Which they do. Just to rub it in, he's accompanied by the AP of the Fourth Wall who's been narrating the story.
 * Lampshaded again in the Great Fables Crossover by Science Fiction, the AP of the science fiction genre, who proclaims that the Fables would be wiped out by a surprise legion of Nebularian attack cruisers, because otherwise, how would they win at the end? Dex also makes an appearance to mock the trope, popping up several times throughout the story to inform anyone who will listen that he won't do anything yet, and only showing up to save the day when it was decided that it was impossible to permanently stop the Big Bad.
 * In the "Caged Angels" arc of Thunderbolts, a group of telepaths mange to infiltrate Thunderbolts Mountain and wreak havoc by mentally controlling the team. The telepaths are finally defeated when Bullseye (who was critically injured in the previous arc and hadn't shown up at all for several issues) wakes up in the hospital and randomly decides to do target practice in the holding cells.
 * On top of which, for some sudden handwaved reason, said telepaths couldn't control his mind. Note that Bullseye is Badass Normal and until then did not have any kind of immunity from Psychic Powers.
 * Possibly explained due to the fact many of Bullseye's bones including spine and skull are reinforced with strips of adamantium (think a lesser version of Wolverine's procedure). This could account for the immunity.
 * In a certain The Creeper story Ryder's psyche gets unbalanced which to plague the city and this problem is suddenly resolved when
 * Superman builds a literal Machina with the Miracle Machine in Final Crisis.
 * Referred to in Watchmen, even though it never actually happens. Dr. Manhattan even provides the translation.

Laurie: God, Yes. Yes, I was just thinking... But Jon, how did you know? I need to see you, you appear... I mean, it's all so Deus Ex Machina...

Dr Manhattan: "The God out of the machine." Yes. Yes, I suppose it is..."


 * In an early story in the Marvel Transformers Generation 1 comic, all the Autobots but Ratchet have been killed by Shockwave, who has gone on to seize command of the Decepticons. Megatron has found Ratchet and is just about to destroy him when Shockwave sends a message ordering him to drop what he's doing and bring him Optimus Prime's head. This gives Ratchet just enough time to offer Megatron a deal...
 * Done absolutely straight in an issue of Namor. He died, and Poseidon came out of nowhere and brought him back to life. Rather than hiding this issue away, they slapped a special holographix cover on it to bring in new readers.
 * The Powerpuff Girls #18: When Bubbles misses her cue in a battle routine against a monster caterpillar because she's protecting a butterfly from getting its wings wet, Townsville comes down on her for it. But later, the caterpillar becomes a monster butterfly and after beating the bejeezus out of Blossom and Buttercup, Bubbles zooms in and defeats the monster by getting its wings wet and it explodes.
 * Justified by the Time Travel plot in Universal War One:  It is one of the very few examples of a plot-relevant deus ex machina.
 * The Mirage Teenage Mutant Ninja Turtles Mirage comics were a little too fond of having the day saved by some random (and often unannounced) outside element instead of letting the Turtles themselves contribute to the solution of the plot. Occasionally, though, it was put to very good effect, such as Renet's unexpected appearance in Juliet's Revenge or Splinter being able to send a devastating psychic strike at the bad guy from several miles away in the last part of the River trilogy.
 * Used very well in Morrison's run of Animal Man.
 * Of course,
 * Bio Apocalypse has a.

Fan Fiction
": This is the most fun we've had in decades!"
 * Chillingly done in the Pokémon fic No Antidote.


 * Naruto Veangance Revelaitons has quite a few. The most blatant is when Ronan and Sakura are fleeing Madara, only to get intercepted by Taliana. A bolt of lightning suddenly strikes Taliana, incapacitating her and enabling them to escape without Ronan having to do anything.
 * In In This World and The Next, Harry and Hermione are sentenced to the Dementor's Kiss for killing Ron the Death Eater. Instead, the Dementor explodes and releases their life force, allowing them to go back in time.

Film

 * A literal example in The Matrix Revolutions. Just as it looks like the Sentinel army is about to completely destroy Zion, Neo travels to the Machine City and asks the god-like supercomputer that rules the Machines (who has never been mentioned before this point) to consider peace. The supercomputer agrees, and the Machines immediately break off their attack. The supercomputer's name? "Deus Ex Machina"--a literal and figurative "God from the Machine".
 * Infamously done in The Adjustment Bureau, where the main characters are predictably surrounded with no escape. Realizing they're about to be separated forever or worse, they kiss passionately...for quite a while...and then they're alone, with the one good "bad" guy telling them that, LITERALLY, God decided to give them a happy ending because they tried really hard.
 * In the movie adaption of The Bad Seed, Rhoda has gotten away with murder, so in the last second of the movie, she is hit by a bolt of lightning and falls into the nearby wharf, supposedly from God's wrath.
 * The example listed in Fridge Brilliance comes from Die Hard, where Carl Winslow, who doesn't ever want to use his gun in the line of duty, shoots the suddenly-risen Karl from behind to save John McClane.
 * Semi-literal in Contact, where thus not only solving the problem but also putting the main character in the driver's seat of the machine. This also occurred in the novel the film is based on.
 * Lampshade Hanging in Dodgeball a True Underdog Story, where the is clearly labeled "Deus Ex Machina."
 * An unusual example of a deus ex machina as a Take That: Executive Meddling forced the creators to . Hence the obvious Lampshade Hanging.
 * This is debatable. The "original ending" scene may have been part of a gag, as the film would have left several Checkov's guns unfired had it not been included.
 * Used spectacularly in The Abyss.
 * In Raiders of the Lost Ark, Indiana Jones  Some extra emphasis  " in this trope.
 * Actually, it's not so much  that falls under this, as it is established throughout the movie that the   but rather the way that  . That comes out of absolutely nowhere.
 * Those who've read The Book of Samuel (as Indy presumably did when researching the Ark) know that  This is not so much a case of Deus Ex Machina as it is a case of much of the core audience not having read that section of The Bible that foreshadows that plot point. Which, when considering that the film is promoting the researching nature of archeology, and that as an archeologist Renee Belloq's greed and pride cause him to be inattentive to the exact information it was his job to be an expert in (contrasting with Indy of course), is arguably some high-minded Fridge Brilliance.
 * This one bears some analysis. It is indeed a very formal example of Deus Ex Machina, in which our protagonist loses his agency altogether and becomes a passive bystander, a witness (or non-witness, as the case may be) to the climax. And yet few people walk away from the film complaining about this fact. In other words, Tropes Are Not All Bad.
 * In Stranger Than Fiction, Kay Eiffel
 * This was foreshadowed from the beginning. But, given the overall plot, it could have been retroactively included by Eiffel to  Indeed, she even says she'll need to re-write other parts of the story to justify the new ending.
 * Used magnificently in the climax of O Brother Where Art Thou, in which after saying their prayers, the four main characters are miraculously saved from hanging by a scheduled flood, lightly mentioned earlier within the film.
 * Towards the end of South Park Bigger Longer and Uncut, Canadian comedians Terrance and Phillip are gunned down by Kyle's mother, triggering Satan and Saddam Hussein's takeover of the world. All seems to be lost until Saddam insults Satan one too many times after receiving several brutal electric shocks from Cartman's V-chip. Satan finally stands up to Saddam and kills him, thanking Kenny for giving him the courage to get out of his abusive relationship, and grants him one wish. Kenny's wish is for all the horror and tragedy of the US-Canada war to be undone, even if it means going back to hell himself. Within a matter of seconds, everyone who died in the war is revived and Canadian/American relations are restored.
 * Also, instead of going back to hell, as a reward for his sacrifice, Kenny
 * In Shakespeare in Love, The Bard's latest play is about to be shut down due to rules against letting women on stage, but then Queen Elizabeth stands up and inspects Viola, and strongly implies Viola isn't female -- and that this queen should know such things.
 * Regina ex machina. But wasn't the idea supposed to be that Queen Bess is on Shakespeare's side, and deliberately helping him?
 * There's also the line where she asks Shakespeare to come as "himself", heavily implying that she knew when he was disguised as "Wilhelmina" at the court in Greenwich.
 * In Give My Regards to Broad Street, the main conflicts are resolved by our protagonist
 * Parodied in History of the World Part One when the horse with the Meaningful Name of "Miracle" manages to Time Travel in order to arrive to save the hero.
 * The timely and stealthy arrival of the T-Rex at the end of Jurassic Park.
 * That was not a deus ex machina. The ending of Jurassic Park 3, however, definitely was.
 * Considering the T-Rex is huge and loud, his sudden appearance is hard to explain.
 * We witness dinosaurs attacking other dinosaurs a few times beforehand. That T-Rex being unnoticed by the characters is a case of Behind the Black, not Deus Ex Machina.
 * The original script had the bones of the T. Rex skeleton falling on and killing the Raptors. Rexxy showed up because the animators felt it was just too awesome not to use again. The end of 3 is more-or-less faithful to the book, with the Costa Rican government saving the day.
 * See the bottom of the article for Samuel L Jackson for more on the stealthy T-Rex.
 * Employed brilliantly in Adaptation, in which Charlie Kaufman (Nicolas Cage) is told by a screenwriting guru (Brian Cox) never to use a deus ex machina under any circumstances. Which of course leads Kaufman to employ that very device at a crucial moment at the end of the film.
 * Lampshaded/subverted/amazingly executed in a triple entendre by Woody Allen in Mighty Aphrodite. Mira Sorvino's character finally finds love with a good-looking pilot whose helicopter needs to make an emergency landing right next to her. Woody's voiceover exclaims, "Talk about your deus ex machina!" - a surprise resolution achieved through outside intervention, with an Adonis-like figure emerging from a literal machine. The icing on this trope cake is that this ending occurs as an ostensible result of the Greek chorus appealing to Zeus, only to get his answering machine, advising them to leave a message and he'll get back to them. God from the machine, indeed.
 * Spider-Man 3: Do you remember that oddly convenient scene with Harry's butler before ? If that didn't look like something yanked out of a guy's rectum, nothing will.
 * It's suggested that.
 * If so, that makes it even worse.
 * The Godzilla films of the 1960s-1970s were notorious for this. The two most infamous examples are the "Flying Godzilla" scene from Godzilla VS The Smog Monster and Jet Jaguar somehow programming himself to grow to the size of Godzilla in Godzilla VS Megalon.
 * The James Bond films liberally feature number 3. Typically the writers would put Bond in the most impossible situation they could come up with, and then figure out what kind of weird gadget could get him out of it before going back to the Q Branch scene to write in a bit of dialogue about it. Though sometimes they didn't even bother; witness Bond's magnet watch in Live and Let Die which in the climax turns out to also be able to cut through ropes with zero setup beforehand. Ironically, that was one of the more plausible James Bond gadgets.
 * Also, the watch laser that Bond uses in Goldeneye to escape from the train car. Not too far-fetched since it's James Bond movie, but what makes it fall under this category is it not being shown during the scene with Q, where all the other gadgets are introduced and talked about. Bond just pulls the laser out of nowhere and it's conveniently the perfect gadget to use in such a situation.
 * In the 2008 remake of Day of the Dead, the zombified Bud, despite being a zombie,  Towards the beginning of the movie, Bud explains that.
 * In Dresden the protagonist and his love interest are holed up to avoid the carbon monoxide poisoning and fires (yeah, THAT will work), while their oxygen slowly runs out. Then, suddenly the protagonist sees a miraculous chink of light, where fresh air is coming in! They dig themselves out into another room, which has an iron-rung staircase leading out - saved!
 * In National Treasure, the characters follow cryptic clues all over the world to discover a massive treasure hidden under Trinity Church, but only after the Big Bad has left them stranded underground with no way out... except for the convenient back door exit to the treasure room. Somewhat justified, seeing as the main characters tricked the Big Bad into leaving them stranded, specifically because they had guessed that there would be a back door.
 * Used in Monty Python and The Holy Grail, both times for laughs. When the characters are being chased by a large animated monster, the animator abruptly has a heart-attack and the monster disappears. The cops at the end are a #4 example, as the movie had been setting them up throughout. The instigation for the police involvement - i.e. the somewhat random killing of the historian - also serves as a sort of Chekov'sGun in an Unwitting Instigator of Doom fashion.
 * In Monty Pythons Life of Brian, where Brian nearly falls to his death, a passing UFO just happens to abduct him and then crashland shortly afterwards. Brian is fine.
 * Random Camp Passer-By: Ooh, you lucky bastard!
 * Cool World may have one of the worst. "Noid" (real person) Frank Harris is killed by "doodle" (cartoon character) Holly Would but is brought back to life by turning into a doodle, because that's exactly what happens when a noid is killed by a doodle in the real world and then his body is brought to Cool World. This is never mentioned until the very end of the film.
 * Transformers Revenge of the Fallen has a classic example. When Devastator climbs the pyramid, Simmons
 * Er... it's probably justified that they didn't use it again.
 * To a slightly lesser extent, The Matrix of Leadership might also be considered a Deus Ex Machina
 * An almost literal example of the classic meaning in Revenge of the Fallen. When
 * Although Fridge Logic kicks in when That said, this is probably more ease of being able to be retconned into esting lore than good righting.
 * Undersea Kingdom, just like the many weekly serials around that time, is notorious for this. The end of each episode has a Cliff Hanger but they rewrite part of the script to allow a Character Shield. (For example, they have important characters collapse on the floor at the end of one episode in a dangerous area, but the beginning of the next, they add a hole that to show they fell on the floor below in a safe area, hoping that people won't remember the nearby dangerous sparks shown while they were collapsing.)
 * A spectacularly obvious version happens in Beerfest. After
 * The astonishingly horrific ending to the travesty of modern cinema that was Epic Movie when one of the characters found the remote from Click and paused time to defeat the White Bitch, who had turned into Davy Jones.
 * The god out of the machine that saved the protagonist in The Hudsucker Proxy was fairly literally a god working in a big machine.
 * Played dead straight in Wizards of Waverly Place the movie with the Stone of Dreams, the MacGuffin that Alex and Justin spend most of the movie chasing.
 * At the end of the flimsily plotted ABBA: The Movie, Ashley, the disc jockey who has chased ABBA all over Australia to get an interview arrives at their hotel after the band's already left for the airport. Despondent, Ashley returns to his own hotel and gets on the elevator... and finds all four members of ABBA inside. ...Cue the trippy song sequence!
 * Done also in I Wanna Hold Your Hand. The 2 main characters end up missing The Beatles at the Ed Sullivan Show. But the Fab 4 (dressed as cops to escape the fans) end up getting in their car.
 * A literal case in Disney's The Hunchback of Notre Dame. The Big Bad spends the movie on a reign of terror that he proclaims to be for a higher cause, sings a Villain Song that's an inverted confession of sins, and assaults a cathedral. When he's swinging a sword and raving about how He shall cast down the wicked, the gargoyle under his feet roars at him and breaks off.
 * The Family That Preys had one at the end when Alice, Pam, and Nick come in to the board room meeting as major stockholders, something never explained prior, and voted to prevent Charlotte from getting voted out of her own company.
 * Apocalypto, however for some people this carried Unfortunate Implications.
 * One of the finer examples of the trope in film history can be found in Robin Hood Prince of Thieves, wherein the deus ex machina is not only set up at the very beginning of the film but also made into the resolution of a story-long running gag. In the opening, Robin saves Azeem's life and Azeem is determined to follow him wherever he goes until he can return the favor, but throughout most of the film every time Robin is in danger and Azeem is nearby there is always something preventing this from happening: he can't get behind a locked door, or he is captured, or he is busy doing something else and doesn't want to be bothered (odd priorities this man has, but Robin does stay alive so maybe he does really have his back). Then at the end of the film, after Robin kills the Sheriff with Chekhov's Gun--er, Chekhov's Knife--the fallen witch gets back up and attacks him from behind. During the entire fight between Robin and the Sheriff, Azeem, once again, was stuck behind a door, but when the witch performs her surprise attack he finally breaks through and spears her from across the room by throwing his scimitar, then says, "I have fulfilled my vow."
 * The Michael J Fox film For Love Or Money. He gets the girl but loses the guy who has agreed to finance the construction of his hotel. On his wedding day, Mike is called by a real estate tycoon who agrees to bankroll the project. The tycoon was the man who's marriage Mike helped rekindle.
 * The Disney film The Black Cauldron. While the cauldron is the first artifact and/or character introduced, the Deus Ex Machina is how it takes out . While it was explained that a living person entering the cauldron of his or her own free will would seal its powers, it is not explained why it kills the guy and destroys the castle. It's implied that it's just that evil, but that's a rather flimsy explanation. It is also highly anticlimactic, because the  doesn't get to DO anything, despite being hinted as being a powerful sorcerer. Another is supplied by the witches, who  . And why is it that the witches have this cauldron in the first place and the heroes practically fall on top of apparently the only society that knows where they are?
 * Much of this can be blamed on Adaptation Decay. The book explains a lot of these questions, especially why the witches had the cauldron and how the heroes were able to find them.
 * Billy Preston in Sgt. Pepper's Lonely Hearts Club Band. He appears just before the end as a weather vane brought to life, then, all while singing "Get Back." Shame he couldn't have done something similar with the Beatles themselves...
 * George of the Jungle 2 uses a #2 version for laughs. The villain has the heroes at gun point then begins arguing with and then insulting the narrator. Then he asks the narrator what he is going to do. It turns out the narrator is the big man himself and a giant hand descends from the sky and carries off the villain while giving him a wedgie.
 * Casino: Though based on a real-life event, the.
 * The Departed: The scene at the end where seems to be a pretty clear example of #2.
 * In fact, in the original film Infernal Affairs,
 * The Girl With The Dragon Tattoo:
 * In fairness, In the book,
 * The ending of Lost Boys; excusable under Rule of Cool, Rule of Funny, and coming right on the heels of a Diabolus Ex Machina, after the villains had already been defeated.
 * In the climax finale of The Traveler,.
 * Inverted in the western Ulzana's Raid. The renegade Apaches have a settler trapped inside his house, which appears to be well-built to resist such an occurrence. Suddenly we hear the sound of a bugler sounding "Charge", the Apaches disappear, and the settler exits his house, praising God. It turns out that . When the real cavalry arrives hours later, they find the man tortured to death.
 * One occurs in the climax of Tangled, but it's actually done pretty cleverly.
 * The 2010 remake of The Crazies pulls a type 2 several times. Each time a crazy person with a melee weapon is about to kill off one of the good guys. As they raise their weapon to strike... they get shot by someone off screen - one time, through a second floor window by someone outside the building.
 * A very good type 4 happens near the end of Naked Gun 2½: The Smell of Fear. The villain survives falling out of a window thanks to an awning cushioning his fall. When he gets up, it seems like he is going to escape. Just then, a lion appears out of nowhere and kills him on the spot. It looks like a type 1 until one remembers that earlier in the film Drebin released a bunch of animals from the zoo.

Literature

 * 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 original version there was no woodcutter.
 * 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.
 * 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.
 * 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.
 * 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 Deus Ex Machina, you have no idea what Adams is capable of. In his third book, The Plague Dogs, Adams does an Ass Pull and saves the day, with a poem that is basically a back and forth between the author and the reader in which the reader complains that the ending sucks, and the author agrees to change it just to shut the reader up. It was so bad that the movie version's ending is preferred, despite the fact it is basically the two dogs drowning pointlessly.
 * The Eye of Argon has a beauty. Grignir, the barbarian protagonist, is locked in combat with a bunch of cultist. During the fight, one of his opponents just drops dead in the middle of the fight from an epileptic seizure.
 * Jane Austen's Northanger Abbey ended with a Deus Ex Machina, which felt quite jarring compared to the rest of the book.
 * Since that novel is a parody of gothic novels, one assumes that Austen did this intentionally.
 * It WAS intentional, and in fact stated in the text. It was even 'foreshadowed' just so she could write it that way.
 * Especially as we know that General Tilney is not amazingly steadfast, we've seen him be fickle in the course of the story, so we know that something will make him relent.
 * 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, does it in the most dramatic manner possible all the time.)
 * 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
 * In the book after spoiler: the Fallen Angel Lasciel's Shadow (who had been providing him with Hellfire), he is provided in the next book with access to Hellfire's Good Counterpart, Soulfire, by Archangel Uriel.
 * 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 Buddah, 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.
 * The Mill On The Floss by George Elliot. 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 our main character 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 of Deus Ex Machina.
 * 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 in Deadhouse Gates.
 * The appearance of in House of Chains.
 * 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.
 * 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; 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.
 * Played painfully straight in Goodkind's Sword of Truth: Richard Rahl's Gift (basically magic) is Deus Ex Machina. 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.
 * Stephen King's 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 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 done and the gunmen on the stairs. BUT WAIT!!! Alex remembers seeing a giant orange cone/construction equipment (not mentioned before) and jumps off the building into, allowing him to slide from safety away from his assailants!
 * Also by King: 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!
 * 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.
 * Meyer's 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 the fourth and final book, however  Actually, the entire fourth book is crammed FULL of this.   Oh, and the big one:.
 * Though, not all of those are actually Deus Ex Machina.
 * In James Thurber's The 13 Clocks, when Prince Zorn and the Golux have brought the duke the jewels, he counts them: they are nine hundred and ninety-nine, not the thousand he had demanded. The Golux stares at his ring, and a diamond falls out. Which lets the duke gnarl about a Golux ex machina.
 * JRR Tolkien occasionally uses Giant Eagles to whisk his heroes away from danger. These aren't just at the end of 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 arguably 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. Possible objections: Sauron would definitely notice and set up Nazgûl interception and/or tens of thousands of Orcs on the mountain, the Eagles weren't even at the Council of Elrond, Manwë wouldn't send his eagles on a suicide mission, God thinks that defeating evil effortlessly would eventually backfire, Mount Doom is the seat of the greatest power in Middle-Earth and it's uncertain whether anyone could toss away its embodiment there willingly, the Ring corrupts the powerful so that Galadriel and Gandalf refuse to even touch it - and you want to put the thing on Gwahir the Windlord for days on end?!
 * 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.
 * 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.
 * Walter Moers loves playing around with this trope; pretty much all his novels feature SEVERAL of these. And sometimes they FAIL. It's taken to ridiculous extremes at the end of Der Schrecksenmeister, where
 * Or in Bluebear, where at various points
 * The War of Souls trilogy of the Dragonlance novels ends with . This one gets bonus points since the event serves as deus ex machina in at least two other novels set during that time.
 * House of Leaves has one, in which . If you give in to the symbolism of everything that's happened thus far, this almost seems Justified Trope. Almost.
 * Throughout the book, however, the House
 * 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.
 * 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.
 * Inheritance: Murtagh learning the name of the Ancient Language.
 * 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. No, really.
 * For that matter, at the end of Sunset seems a bit too convenient.
 * 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.
 * 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. In Snow White's case, the fact that a kiss can wake her isn't previously mentioned. Rapunzel's tears cure the prince's blindness. A hunter just happens to walk by Grandma's house as the wolf is attacking Red Riding Hood. Although it occurs midway in the story, there is also Cinderella's fairy godmother.
 * Spike Milligan's Badjelly the Witch. The titular witch is chasing the hero and heroine, who are fleeing her lair, when intervenes. When she refuses to back down and tries to, he annihilates her.
 * In The War of the Worlds, the martian forces are almost unaffected by everything the humans throw against them, until
 * Not totally out of the blue, however, as, this is probably an analogy to.
 * 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.
 * Monstrous Regiment plays the trope much straighter, which brought about much debate and anger from the readership.
 * In Harry Turtledove's Wisdom of the Fox,
 * Michael Crichton novels live on this. The main characters work heroically to try to solve a problem (which as often as not was created essentially by a couple of bad decisions, followed by a series of events where exactly the worst possible thing happens in each case), almost but not quite succeeding at several points, only to find out in the end that the problem effectively goes away on its own. To be fair, that can be part of the appeal.
 * A at the end of Tehanu.
 * 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 De Power him before he burst into flames and died from. 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
 * 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.
 * M.M. Buckner's titular Watermind survives everything the humans throw at it before being killed by  Okay, there was foreshadowing, but getting it would have taken someone who was both better at science   and geography   than the protagonists, which takes Viewers Are Geniuses to levels that would make Light Yagami throw up his hands in disgust.
 * A frequent criticism of The 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."
 * 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.
 * 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".
 * There are roughly 2 actual concrete examples of this trope in Harry Potter, all of them intentional. The first instance is in book one,  However, due to the Rule of Symbolism, this ending works out quite satisfyingly. The other is when  . Both of these play a huge role in the later events of the series.
 * You could say that is a subversion of this trope if you assume that it was foreshadowed by Dumbledore's vague parting words before he was asked to leave Hogwarts.
 * This leads to Fridge Brilliance when you realize that Dumbledore stated that he'd only truly be gone from the school when there were none left who were loyal to him. Fast-forward to.
 * All other accused instances of Deus Ex Machina in Harry Potter actually turn out to be Chekhov's Armoury and more Fridge Brilliance.
 * 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,
 * Happens in The House of Night, with a literal goddess (Nyx) appearing in Awakened at  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.
 * Invoked Trope 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 Deus Ex Machina largely because the Deus in question turns out to be an old enemy of his.
 * 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 are 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.
 * Deliberately done in Lord of the Flies, where after, a Navy ship shows up out of nowhere to rescue them, symbolizing how quickly the appearance of an authority can change everything.
 * At the end of A Tale of Two Cities its mentioned that Darnay and Carton happen to look a lot alike.
 * Actually, the resemblance is mentioned early on in the story,
 * 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).
 * 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 . Hints that   was present were scattered throughout the book, but were relatively subtle, and the reader is expecting a hard sci-fi war novel, and not.
 * In Bulgakov's The Fatal Eggs, an army of giant tropical animals is advvancing towards Moscow, when they are all killed off by an unexpected frost. Bulgakov calls the chapter "A Frosty Deus Ex Machina".

Live Action TV

 * Some Buffy the Vampire Slayer fans would nominate the sudden appearance in "Touched" of a Forgotten Superweapon in the sewers, immediately followed in "End of Days" by the discovery of a "feminine counterbalance" to the Watchers (who had female members anyway) hiding in a pyramid-shaped crypt that Buffy had patrolled past for the entire seventh season.
 * The conclusion of series 4, when they suddenly discover that they can all magically pool their power together so that Buffy is some sort of demigod, allowing a previously nigh-on indestructible foe to be abruptly, casually eliminated with a single blow. They then never use this power again (although this is explained by the potentially fatal nightmares it causes in the next episode).
 * Or that in the Seventh Season Buffy is able to start telepathically talking to Willow and Xander. It's previously been established that *Willow* can talk to them all using telepathy, but this is because *she* is the witch and had presumably cast a spell to do so. There is also no indication that they can talk back to her, much less to each other. One would think it would have come up in the series previously that the characters could start talking to each with their minds at any given moment.
 * A definite runner up would be Olaf's Troll Hammer suddenly being the weapon of a god.
 * On Angel, Lilah actually uses the trope (although she says God ex Machina) to describe the situation after Angelus tricks everyone into believing he was Angel again.
 * Episode 3.19, "The Price",
 * The power doesn't just exterminate demon slugs. It purifies darkness. Huge light = death to creepy monsters from "Darkest of the Dark Worlds".
 * When the time came for hosting duties to be handed over on Mystery Science Theater 3000, Joel Robinson's escape was facilitated by a hidden escape pod actually called the Deus Ex Machina; the explanation for its remaining undiscovered throughout the run of the series was that it had been hidden in a crate of Hamdingers, a particularly repulsive snack food that none of the crew wanted to touch.
 * In the episode Space Mutiny, the existence of three more escape pods is revealed... only for them to be destroyed in a mock space battle between Tom, Crow, and Gypsy since the idea of using them for escaping never occurred to any of the 'bots
 * In the Doctor Who episode "Doomsday", reversing the effects of opening a breach to the void that's been pulling Cybermen and Daleks through not only seals the void, but pulls back in any material that passed through it due to them holding background radiation. Also, it can be closed from one end.
 * The Season 3 finale is a glaring example of a Deus Ex Machina. A satellite network which was used for subtle mind control by the Master is suddenly capable of giving the Doctor superpowers (telekinesis, regeneration, de-aging, flight and a force-field) provided everyone in the world thinks the word "Doctor" at the same time.
 * Finally, in Journey's End it is established that Donna will die if she remembers her time with the Doctor, there's an entire scene dedicated to how important it is that she never remember. In End of Time a year later, it's revealed that the Doctor was being somewhat melodramatic as he had in fact installed a buffer to prevent her from suffering any harm whatsoever if and when she remembers.. and just forgot to tell her family. In fact the act of remembering her previous life is actually pretty beneficial as it knocks out a bunch of master clones with no ill effects whatsoever.
 * The series also occasionally uses Stable Time Loops as Deus Ex Machina as well:
 * In "The Big Bang", the Doctor is permanently sealed inside the Pandorica with his Sonic Screwdriver, which is the only thing that could be used to open it from the outside. Suddenly, a future Doctor appears to give Rory the Screwdriver, allowing him to open the Pandorica, thus allowing the Doctor to escape and give the Screwdriver to Rory.
 * Other examples of Deux Ex MachinaStable Time Loops saving the day: In the short Time Crash, the Tenth Doctor knows what to do because he saw what he did when he was the Fifth Doctor watching the Tenth Doctor do it. In the shorts Time/Space, an Eleventh Doctor from slightly into the future comes back and tells the present Doctor which level to pull. These shorts were for charity, though.
 * Supernatural, "All Hell Breaks Loose": Okay, so the gates of hell had been opened but it's still a bit unbelievable/convenient that just as Azazel is about to shoot a restrained Dean, Sparkly!John fights him off just in time for Dean to get the Colt and finally kill the Big Bad himself.
 * Used repeatedly by Monty Python's Flying Circus for comic effect, when they weren't otherwise deconstructing narrative convention. Think Graham Chapman's colonel stopping a sketch because it had become "silly". They have stated that they would do this when they had no idea how to end a sketch.
 * At the end of 1984's V: The Final Battle, Diana has activated a thermonuclear device that will destroy Earth. All attempts to deactivate it or remove it from Earth's atmosphere fail. At this time, Half Human Hybrid Elizabeth, who is only a few weeks old but has aged inexplicably to a 10 year-old, steps forward, grabs the doomsday device, begins to sparkle and glow, and somehow deactivates the nuke. There is absolutely no suggestion at any earlier time that Elizabeth might have magical powers, nor are magical powers any part of the preceding nine and a half hours of the science fiction miniseries.
 * In A.C. Crispin's novelization, instead of sparkle-glow, Elizabeth hacks into the doomsday weapon's countdown sequence, and inserts an infinite loop. This was at least somewhat more justifiable, in that the novel contains earlier scenes in which Elizabeth was seen demonstrating a knack for mathematical puzzle-solving to go along with her unusally-rapid physical growth. The change to Sparkly Psychic Powers was the due to the usual Executive Meddling, because we all know that Viewers Are Morons and wouldn't be able to get their heads around the idea of a 6-year-old alien star child being able to hack a computer.
 * In Star Trek Deep Space Nine, the founders remove the minefield across the Wormhole, so they can get nearly three thousand ships in reinforcements. This would tip the balance in the Dominion war. Sisko and crew head into the wormhole to try and stop them, despite the fact they have no chance. In the Wormhole, they see the thousands of ships and are ready to throw down when the Prophets tell him he can't sacrifice himself because he is important to them and to Bajor. Sisko tells them that he has to try to stop them, then tells them that if they want to save Bajor, they're going to have to do something about the thousands of ships. So they do. What happens no one quite knows. Sisko's relationship with the Prophets had grown to the point where asking them for a miracle may seem like the next logical step.
 * Happened in several Star Trek the Original Series episodes.
 * "Charlie X". At the end the Thasians show up and take Charlie away.
 * In "Shore Leave", after the Enterprise crew faces innumerable threats to their safety, the Keeper shows up and reveals that the planet is just an amusement park.
 * In "The Squire of Gothos", just as Trelane is about to destroy Captain Kirk his parents appear and make him come inside.
 * In "Errand of Mercy", the Organians appear throughout the episode to be complete pacifists and helpless victims: at the end they reveal themselves as superbeings who calmly stop the war between the Federation and the Klingon Empire.
 * A total Deus Ex Machina occurs in the backstory of Babylon 5. During the Earth-Minbari War, the human forces never had any chance and never managed to destroy even a single Minbari capital ship in battle (with the exception of Sheridan destroying the Black Star). The Minbari's goal was nothing short of Kill All Humans, but when the invasion fleet entered Earth orbit and wiped away the last remnants of the human fleet, they suddenly ceased fire and offered an immediate and unconditional surrender, just moments before turning Earth into a smoldering wasteland. The humans never found out why, but the reason is that the supreme Minbari government was observing the final battle and had a human pilot captured for research. However, it was discovered that he had a Minbari soul, indicating that humans and Minbari are at least in spirit the same race, which had the council order an immediate stop to all hostilities. Even the Minbari had never seen that coming.
 * Another Deus Ex Machina occurs with the pilot they captured. As it was actually.
 * And then there's possibly a third Deus Ex Machina with the whole event that started the war. When humans and Minbari first meet, the humans accidently killed a few Minbari. What are the chances that the first Minbari ship they ever encounter was currently transporting the supreme religious leader and that he would be among those killed by exploding power lines?
 * Medium had two Deus ex Machinas when Allison was faced with spiritual enemies:
 * The new Battlestar Galactica Reimagined is full of them, more and more as the series progresses, and.
 * Primeval had one of these at the end of the most recent series, when a baby raptor just happened to follow Helen and Danny Quinn through an anomaly and then proceeded to leap at Helen, throwing her off a cliff just as she was about to leg it. A real Deus Rex Machina.
 * Since the entire series is about creatures randomly wandering through time anomalies, it's not so much of an example. A much better example is the end of the first season:
 * Well, seeing as the cast was in the gorgonopsid's time period, it isn't that unusual that a gorgon would come charging down to face an intruder in its territory. In fact, seeing as the
 * Children's light-drama series Byker Grove had a spectacularly blatant Deus Ex Machina in its final episode - the episode in question was even * titled* "Deus Ex Machina". The characters are informed by the unseen Writers that they are fictional, and that their youth club and indeed their whole world is also fictional. The Writers are planning to end the story after this final episode by having the Grove bought and knocked down, but can't bring themselves to destroy their creations, so they give the characters some magic script paper to write their own endings. Hilarity Ensues as the characters write their dream endings, but forget to try to save the Grove until the last moment, when it is saved by Stumpy, possibly the dumbest one of the whole bunch, who finds some previously unmentioned buried treasure (lazily foreshadowed just 2 minutes earlier in the episode). He buys the Grove, thereby saving it, and the moral of the story is that the characters have the ability to write their own story, and are no longer dependant on their creators for their existence.
 * Season 2 of Dexter had a false Deus Ex Machina.
 * An episode of Lost titled "Deus Ex Machina" features a literal case when Locke and Boone find a crashed Beechcraft plane filled with Virgin Mary statues (which turn out to be filled with heroin) and a radio. However, this improbable event only makes things worse . At the end of the episode, another literal case occurs when Locke is banging on and screaming at the metal hatch he and Boone found. A light comes out of the door which renews Locke's faith in the island ..
 * I Carly has Freddie invent a 'mood app' that can apparently detect that Sam is 'in love'. How it got made was never discussed. It never showed up in a previous episode. Despite being illogical and unworkable even by I Carly standards, for some reason everyone in the show takes it at complete face value the instant they turn it on. A total Deus Ex Machina used as a lazy Ass Pull to setup a 5 part Romance Arc without having to go through any of that pesky character development.
 * Stargate Atlantis featured several Deus Ex Machinas in the form of the Daedalus ship.
 * Or the ZPM conveniently found in Egypt in the season 1->2 Siege storyline, enabling
 * In continuity of Stargate Atlantis it is, but at the same time Stargate SG-1 had two-parter about making ZPM be found in Egypt
 * In Stargate SG-1's fan-special 200, this trope (among others) is parodied and lampshaded by the characters. The Deus Ex Machina comes in the form of the Asgard beaming the heroes out of danger Just in Time, which happened a few times in the show normal.
 * The producers of the Aussie soap Return to Eden were sort of forced into making one to tie up the loose ends from the final ep's Cliff Hanger ending, under the belief that they couldn't sell a show like that overseas. Video.
 * Planned but unused literal example:
 * In the finale of Power Rangers in Space, Zordon pulls off an I Cannot Self Terminate suicide bomber attack that kills all the villains, transforms the redeemable ones into Human Aliens free of the taint of evil magic, and brings the red ranger's dead sister back to life after a few minute delay, neatly tying up all the loose ends of the series.
 * Prison Break season four opens with Sucre, Bellick, and T-Bag somehow escaped from Sona. T-Bag could actually be explained, but not the other two.
 * Monty Python's Flying Circus has a literal example in the "Church Police" sketch. The mystery of the murder is solved by... The Church Police beseeching God for an answer. The Hand of God is immediately lowered onto the set (by a crane no less) and points out the killer. Very much Played for Laughs.

Music

 * In the Music Video for Cyndi Lauper's "The Goonies 'R' Good Enough", Andre the Giant appears out of nowhere (literally, just a puff of smoke, and there he is) to chase off the bad guys.

Mythology

 * Funnily enough, there are many times in Greek Mythology where the gods and goddesses fail to do this all the way through; they may do something which only partly rectifies the situation or has its own shortcomings to it - though that may be due to them being Jerkass Gods.
 * Not all instances from classical mythology are subversions, though. For example, at one point Hera offers her aid to the argonauts to get them through. It's the only time in all of antiquity when she was depicted as acting nice, let alone toward heroes. In fact, the entire name of the trope came from the theatrical device used (via a cherry-picker like machine) in ancient Greek plays based on the Greeks' myths.

Radio Drama

 * While writing the first installment of The Hitchhikers Guide to The Galaxy, Douglas Adams found himself faced with a writer's dilemma: His characters had just gotten thrown out an airlock, and would pass out and die from lack of oxygen in 30 seconds, and it was so utterly improbable that another spaceship would come around within those 30 seconds to rescue them that to have had that happen would've been nothing short of a Deus Ex Machina. This gave him the idea for the Infinite Improbability Drive.

Tabletop Games

 * For some D Ms, this is going to happen eventually. Whether it be a Total Party Kill where it shouldn't be, the players making a decision that turns out to be much worse than they could imagine, or other misadventure, a group of players will find themselves in a situation where the only way out is to basically cheat. Some D Ms will just rewrite recent events, but for D Ms who like to maintain the narrative, this may be the only way out.
 * This is pretty much Modus Operandi for the Legion of the Damned chapter of Space Marines in Warhammer 40000. They appear without warning and aid beleaguered Imperial forces against the enemies of mankind, then disappear as soon as the battle is won just as suddenly as they came.
 * Notably, this is one Deus Ex Machina that creeps the fuck out of the Imperials.
 * Interestingly, one of the theories behind the Damned Legionnaires' appearance is that they are extensions of the God-Emperor's will. Although he's more like Deus IN Machina.
 * Warhammer Fantasy Roleplay and Dark Heresy have the Fate Points, which will unfailingly pull a character out of certain death and put them in a position where you are safe for the immediate moment. For small stuff a Fate Point will turn a killing blow to a glancing one, cause the enemies to take you prisoner instead of killing you on the spot, or let you dodge that lethal fall pit, but it becomes one of these when, say, you've just been killed by being spaced, caught inside a collapsing mine or building, or by having a Cosmic Horror biting your head off.
 * Lampshaded in Munchkin: There's a card called Deus Ex Machinegun that has the gods come down with a machine gun and kill all the monsters, take all the treasure, and make the combat just magically go away.
 * In GURPS, a character can buy an Advantage called Serendipity, which allows one extremely fortunate event per game session to take place at the player's discretion. Who knew "Deus Ex Machina" and "Serendipity" rhymed?
 * The Gizmos advantage is designed to let players imitate fictional characters like Batman and James Bond, as described above.
 * In Spirit of the Century Players may use their characters Aspects, a Declaration, or even certain Stunts to create an unlikely coincidence happen. Players can also have gadgets and artifacts with undefined abilities, so you can decide that they do exactly what you want at the right moment (of course, once you've decided it stays that way at least until the end of the adventure)
 * Shadowrun actually has a rule about this, called Hand Of God. When a PC ends up in some sort of hopeless situation, the PC's player can invoke the Hand Of God, having the GM save the PC via some form of Deus Ex Machina. There's a catch, of course: it has a hefty experience-point cost, and it can only be used once per character.
 * In the tongue-in-cheek RPG In Nomine Satanis Magna Veritas, which is played with rolls of 3d6, anyone rolling 111 means a direct and usually over-the-top divine intervention happens. Which can be a very good thing if you're playing an angel, and a very bad thing if you're a demon. And of course, a roll of 666 causes a direct satanic intervention, which is... yes.
 * An actual game mechanic in World of Synnibarr (really). If your character is on the verge of death with no hope of salvation, you actually get a dice roll to see if your patron deity turns up to haul your arse out of the fire.

Theater
"Diabetes: God is dead."
 * In Euripides's Iphigeneia in Tauris, the play ends with Iphigeneia fleeing with her brother and his friend. They are pursued over the sea, and a wind appears to make their escape more difficult -- but Athena appears to order the pursuit to stop. Many critics have noted that apparently Euripides introduced the wind, which serves no other plot function, solely in order to have an excuse to make Athena appear.
 * Euripides is actually pretty notorious for this: he did it in Alcestis and Medea. Aristotle called him on it in Poetics.
 * And Aristophanes made him a character in one of his plays who at one point enters the stage with a crane.
 * Another big deus ex machina occurs in the original Iphigeneia. You know that sacrifice everybody's been upset about and Iphigeneia finally accepts? The priests come down in the final scene and say that when they looked away Iphigeneia had been replaced with a pig. Not highlighted for spoilers since she obviously lives if there's a sequel.
 * The archetypal DEM (by Euripides again) is at the end of Orestes. Orestes and his sister have been condemned to death for murdering their mother (which Orestes was ordered to do by Apollo, since their mother killed their father, which she did because the father had killed their sister... But anyway, the two of them and Orestes' best friend Pylades have escaped, taken Orestes' fiancée hostage, and are holed up in the palace ready to burn it all down around them...when all of a sudden Apollo pops in and calms everyone down, so everybody is friends and/or married. To be fair to Euripides, this was an existing story, and he probably ended it that way intentionally to be jarring and avant-garde.
 * Compare with the other Orestes, by Aeschylus, the idealist of Greek theater. In his version (the play is called Eumenides), it is Athena and not Apollo who sets things right in the end, and she calls for a trial. She suggests that the matter should be resolved not by blind obedience to the ancient law, but by having the accused judged for his crime in a court of law. Essentially, she says that human beings have matured enough to dispense justice themselves, without relying on supernatural forces and beliefs, and to vote whether they should punish or absolve, in the spirit of fairness. Moreover, the law should err on the side of compassion: when the jury comes up with a split vote, Orestes is found innocent. So, although technically you still have an actor and a crane at the end, this is NOT a deus ex machina. The goddess appears, but for a reason. Indeed, she drives home the whole point of the play. Aeschylus made a social commentary about crime, punishment and justice, and the goddess is a legitimate storytelling device. While Euripides made an action flick, pushed himself into a corner with a ridiculously convoluted plot, and then had to resort to a deus ex machina, a god who simply barges in and announces that Orestes is innocent for no apparent reason. Happy ending, have a good night. (At the time, that was actually considered modern, since a tragedy's normal ending was a huge bodycount.)
 * In the prologue to his Amphitryon, the Roman playwright Titus Maccius Plautus parodied and lampshaded this trope somewhat by having the god Mercury explain to the audience that there's a precedent for having the gods be active characters in this play: wasn't it just last year that somebody performed a play on this very stage in which someone in dire straits called on Jupiter and (lo and behold) out popped Jupiter to save the situation?
 * Shakespeare was generally good at averting and subverting this. Measure for Measure has an ending that probably seems like Deus Ex Machina to the characters, but we the audience have spent the entire play watching the Chessmaster set it up. A Midsummer Nights Dream ends amicably when the fairies step in and fix everything with magic, but it takes them three tries to get it right and in the meantime they screw everything up even worse. The ending of The Winters Tale is either this or Fridge Brilliance, depending on how you read it. But the pastoral comedy As You Like It is a straight example, with the father arriving out of the blue to put all conflicts to rest.
 * In Shakespeare's Hamlet, act IV, scene VI,
 * The Mozart opera Idomeneo includes a literal Deus Ex Machina. Idamante is about to be sacrificed to Neptune, when the god's voice proclaims that he is to live instead and take the throne from his father.
 * In the musical City of Angels, writer Stine finally snaps after witnessing the culmination of the Executive Meddling on his Film Noir screenplay, and the producer sics the studio cops on him. Detective protagonist Stone (appearing as Stine's Spirit Advisor after his part was brutally miscast by the studio) goes over to Stine's typewriter and does a little Rewriting Reality, making Stine beat up the cops and defeat the producer. For an encore, Stone types a little more and reunites Stine with the wife he cheated on: "A Hollywood ending!"
 * Parodied in P.D.Q. Bach's The Stoned Guest. At the end of the opera, every character is killed or otherwise dies. Then, for literally no reason at all, they all spring back to life and sing about how it's a happy ending.
 * Parodied in the Brecht play The Threepenny Opera, where the playwright actually goes to the length of having his characters explain that the play really ends differently... but, for the sake of a happy ending, a royal official enters on horseback to make everything better. The play ends with a comment saying how unlike real life this is.
 * There's a brilliant inversion of this trope in another Brecht play, The Good Person of Szechuan. Just as things have got as bad as they can possibly get for the protagonist, Three Gods (who have been present on Earth since the opening scene, and in fact were responsible for the protagonist's predicament in the first place), pointedly do not step in to resolve matters, and instead mount a giant pink cloud and ascend into the heavens.
 * Brecht was very fond of parodying - and thwarting - an audience's need for closure and happy endings, as it was part of his theatrical manifesto to leave an audience unsatisfied, and thus hopefully motivated to go out into the world and change things for the better.
 * This is the case for a good 90% of Gilbert and Sullivan operettas.
 * Parodied by the ending of The Pirates of Penzance. Turns out
 * Or maybe it's when it when they all instantly surrender when ordered to do so in the name of the Queen. The person who announces that they're all  doesn't seem to have any way of knowing.
 * cf. Trial by Jury and HMS Pinafore
 * HMS Pinafore:  Yeah, it may be Deus Ex Machina, but it just kinda works...
 * It's not Ralph it's Reif
 * Moliere tended to lean on this to wrap up many of his comedies. In Tartuffe the protagonists are saved in the last act when a police officer shows up out of the blue with an order from the king arresting the villain. The conclusion of The School for Wives is so bizarrely complicated that we're still not quite sure what happened, but the gist is that the starcrossed lover's respective families show up to let them know that they had arranged their marriage years ahead of time (without either of them knowing it).
 * Spoofed, perhaps even deconstructed by Woody Allen in his one-act play God, an excellent if strange production which has No Fourth Wall whatsoever; it's nominally about two Ancient Greeks trying to put on a play right there, when Trichinosis shows Diabetes his new invention, a machine for lowering the gods to the stage in order to solve characters' problems. (He boasts that he's going to make a fortune with it: "Sophocles put a deposit on one. Euripides wants two.") Unfortunately, when turned on, it winds up strangling the actor playing Zeus.

Video Games
""That is what people refer to as...Divine Intervention!""
 * While Deus Ex, along with the two other games in the series, were named after the trope, they do not really feature it, though the original game does feature a Deus Est Machina.
 * The protagonist of the first game was the dues ex. The beginning of the game is set in a crapsack world where corporations and conspiracies rule the world and it looks like nothing can improve it. Then Denton comes along and everything is changed. Almost no one could have predicted Denton's actions or just how drastically he would change the world around him. Thus to the any normal person looking to change the world Denton would appear to be a Deus Ex Machina. This is made all the more obvious by the fact that Denton is arguable a Deus Est Machina himself, being one of the worlds first nano-augmented soldiers.
 * Possible subversion in the Mortal Kombat series; Raiden, Earthrealm's god of thunder and supposed Protector, seems to be in the perfect position to pull this each and every time the baddies go after our home realm (which they do in every game), but due to harsh Prime Directive meddling by his supervisors the Elder Gods, can't get away with it without either giving up his godly status temporarily and/or hiring human proxies to do his work for him...and even then, he's punished severely for his meddling.
 * Also subverted in the opening to Mortal Kombat Deception - Raiden uses a previously unmentioned, non-foreshadowed release of his essence in the form of a massive explosion in an attempt to kill Onaga. He doesn't even blink.
 * Regal Bryant from Tales of Symphonia. For the entire game, he runs around wearing shackles, and fights with nothing but kicks. However, at one point late in the game,
 * Justified, as Regal had said he wouldn't take his shackles off until Cruxis was defeated and that he would never kill with his hands again. Also justified in that he said he was much more powerful fighting with his hands than with his feet.
 * Tales of the World Radiant Mythology 2 has Guede who has the obligatory One Winged Angel form which is actually called Deus Ex Machina.
 * Super Smash Bros. Brawl
 * The only inclination the player had about that is that
 * Slightly justified due to Real Life circumstances.
 * Parodied in Banjo-Kazooie Nuts and Bolts with the Lord of Games. Technically, his powers are limited in that he only can control Video Games...but given that this is a Video Game, his power is at Reality Warper levels.
 * Sonic Rush Adventure: Following the fight between Super Sonic & Burning Blaze and the Egg Wizard, the mech begins to unleash its ultimate attack, only to be distracted by Marine firing some kind of energy beam from her fist. Up until this point, there was nothing in the story that suggested that she was anything but a normal, if a tad annoying, little girl.
 * In Sonic the Hedgehog 2006, Sonic gets killed plot-wise. However, suddenly Elise feels "Sonic's presence in the wind" and someone has an idea to try to bring him back with the power of the Chaos Emeralds.
 * In Marathon, those useless BOBs who would get in your way just to get shredded by aliens save your life after you are captured. TWICE.
 * The existence and implications of Deus Ex Machinas is a huge plot point in Resonance of Fate.
 * In Conkers Bad Fur Day, right after Conker throws the final alien boss out the airlock, the alien just jumps right back in. Conker laments his supposed end, and the alien goes in for the kill... and the game locks up. Conker takes advantage of the situation by calling some programmers and making a deal with them: he won't tell anyone that the game locked up, if they help him defeat the alien. He ends up using a katana from the provided weapon rack to save the day.
 * At the end of Ys V, when the city of Kefin is disintegrating, all the characters manage to escape except for Nina, and she is at first presumed to have been destroyed along with the city. However it is later revealed that the phantom Stoker teleported her out at the last second.
 * In the ending of Ys: The Ark of Napishtim, Adol is trapped inside the collapsing Evil Tower of Ominousness of Napishtim, with no apparent way out, and it seems No One Could Survive That. Even worse, Napishtim has summoned a Mega Tsunami in a final act of Gaias Vengeance {also a Diabolus Ex Machina} to wipe out the "false civilizations" of Eresia. Then the goddess Alma(or some say it's a manifestation of the souls of the Rehda), in the form of a glowing angelic figure, descends from the heavens and casts a Beam Spam which nullifies the mega-tsunami and the Great Vortex, averting The End of the World As We Know It, and Adol is safely returned to shore.
 * At the end of Earthbound, the player characters are absolutely helpless until the player him/herself kills the final boss.
 * Lampshaded in Mother 3 when Lucas and company fall from an aircraft. Lucas and Boney land in a conveniently-placed pile of hay. Turns out the ghost of Hinawa told Alec to pile hay in the exact spot where they would fall, through a dream. Wess remarks on this dream of Alec's, saying it's "as strange as strange can be".
 * Oh, and additionally, Kumatora and Duster just happen to land in places where they are rescued by friendly folk. This part is not lampshaded, or even explained at all.
 * The dramatic mood of the scene betrays the fact that the 'Azoth Dagger' from Fate/Stay Night came out of nowhere. The fact that Rin had been brutally assaulted such that there is no way she could have hidden it, makes you wonder about the possible meanings of it's name...
 * No so much out of nowhere if you know Fate Zero. But yeah, the hiding this is a bit weird, unless she has a pocket large enough to fit a shortsword in her Grade S Zettai Ryouiki skirt.
 * Kingdom Hearts has gained a reputation for Kudzu Plot and some rather bizarre twists (even for a series whose basic premise is Final Fantasy meets Disney), but few of them are introduced simply to pull the cast out of an unsolvable deathtrap. During the final battle in II, Xemnas collapses his tower and takes off on a giant mechanical dragon, with Sora and Riku trapped on the crumbling base. Their escape route? A previously-unseen hover bike. The bike's presence there is the unexpected part, not that it could exist in the first place - it just appears out of nowhere so the two of them can keep up with their enemy.
 * Mega Man X 6 had a huge ass pull when regarding the return of Zero. Despite being blown up with nothing but an upper body torso left in X5, he appears healthy and alive in X6 with absolutely no explanation of how he survived. Though this is easily side stepped by the fact that he is a robot, and robots don't truly die.
 * Fortunately, X6 at least acknowledges this. Though Zero claims that he 'hid himself away to repair himself', there's a conversation between Zero and Dr. Light where Zero asks Dr. Light if he knows who it was that repaired him. He doesn't get an answer, but it's still a better explanation than the Ass Pull one that Zero gives.
 * Then there's X being repaired in X5's ending. Who the hell repaired that guy so quickly after the battle? Many assume it was Dr. Light who did so, but he's dead.
 * It's not too far-fetched, as Light pretty much is the Goddamn Batman of that universe. The man's got, like, 1000+ pods, for crying out loud!
 * Not to mention it's fairly obvious that Doc Light's hologram is semi-sentient. Although the question of why he would revive X into a war-torn future when all he wanted for him was to live in peace...I guess he either really likes X, or really hates him.
 * The first game states that X was brought out of stasis during a time after an immense war. Then other robots were modeled after him, and then they went crazy. And so Light was all, "Hey X, you have a gun and I have some crazy upgrades, I didn't want you to use them, but do so now so you can save the world."
 * One scenario in Left 4 Dead ends with this. In "Death Toll" you fight your way all the way through Riverside, PA until you reach the titular river, and there happens to be a house there with a two-way radio tuned to a rescue frequency and a group of nearby survivors with a boat. This differs from the other campaigns, where the means of escape is set up from the beginning.
 * In the sequel, this also applies to Dark Carnival, to a lesser extent: initially, the survivors have no plans beyond going to the carnival. They just happen to see a helicopter, and only then can they work out a plan to call it.
 * Some of the Dialogue hints that they were drawn there by the lights, which they thought meant that there were still people holed up at the carnival. Unfortunately, zombies are drawn to bright lights as well...
 * The same situation happens again in Swamp Fever. The survivors are downed near a derailed train and just decides to walk into a swamp town for no apparent reason. It just so happens that at the end of this was a giant mansion used as an impromptu safe house and Virgil was on the one working radio. There was absolutely no way the Survivors could have known this beforehand, especially since the village itself disliked CEDA and the Military (the only two that are actively trying to evacuate people).
 * The G-Man in Half-Life 2. Also, the purple Vortigaunts at the beginning of Episode One.
 * This one might not apply, both are frequently shown to actually be watching Freeman and stepping in when appropriate. At one point you can see the G-Man giving some rebels a rocket launcher they later give you to use, so it's more like a huge Xanatos Gambit than anything else, and the Vortigaunts seem to have their own going as well. Hopefully we'll get some answers in Episode 3, but don't hold your breath (especially considering Valve has kept us waiting for years...).
 * It can be argued that Freeman himself is one. The G-Man puts him in stasis and brings him out when the time is right for some major shift or other. Imagine what that would look like to someone in the Resistance.
 * The Episodes like to literally Yank the Dogs Chain, and figuratively the player's, by plopping a Diabolus Ex Machina right at the finishing line of a long and arduous trial. Then DOG jumps in from nowhere to administer a concluding beat-down.
 * Deconstructed in Alan Wake.
 * With psychotic glee, lampshaded and invoked in Super Robot Wars MX during a very brutal scene from End of Evangelion where Rom Stoll shows up just as the coup de'grace was about to be unleashed.


 * Choro Q HG 4 has the resolve of 's jump start at the beginning of the climatic race in the end of the story by having
 * The ending scene of King's Quest V Absence Makes the Heart Go Yonder has Crispin, who has been almost useless up until this point, suddenly appear and magically solve all of King Graham's remaining problems.
 * Seen in Pokémon Mystery Dungeon Explorers of Darkness/Time where  This is even more prevalent in Explorers of Sky, where
 * The second example may be somewhat justified, as it's implied that
 * Riviera the Promised Land has one of those right in the ending, when
 * For the finale of Okamiden, you're whisked away to what seems like another dimension. The only one who came with you, other that the Big Bad and his Dragon, is a tiny poncle named Ishaku. No one thinks that Chibi can take on the Big Bad alone, so you help Ishaku summon your partners... by cutting space and time.
 * In Final Fantasy IV -Interlude, after leaves the party while going up  you are attacked by three robots. After taking some damage they unite into one robot which proceeds to knock you into critical status.  comes out of nowhere and helps you saves you by stunning it.
 * In Final Fantasy VIII, late in the third disc of the game Squall and Rinoa have been set adrift in space, and are rapidly running out of oxygen. Then, out of nowhere, a massive adrift spacecraft known as the Ragnarok floats toward them without warning and they manage to board it. It fortunately has enough oxygen and working systems that they can pilot it back to the planet. Though it does come out of nowhere at first, exactly why the Ragnarok was out there and how it came to its current state is eventually explained.
 * In The World Ends With You, No, really.
 * The reason behind ''why' is actually not a Deus ex Machina if you follow what Neku says at the end and possibly . The game gives a perfectly legitimate reason behind why it happened like it did.
 * In Crash Of The Titans, Coco Bandicoot requests Crash Bandicoot to hand her the "Transpalooper" a purple device. They are interrupted by Dr Cortex, and Crash simply pockets the device. After the final boss, Coco brings up that the giant killer robot can be shut down if she simply had her "Transpalooper", which Crash conveniently has had this whole time. A perfect example of the third Deus Ex Machina.
 * Although not part of the story, Saber in Fate/Extra tells the player character a story that introduces about one hundred characters, only for them to all be ignored. When asked about what happened to them, she mentions they're all made happy by a Deus ex Machina.
 * at the end of Mass Effect 3. Though their existence and purpose had been either foreshadowed or known throughout the game, their true nature and abilities seem to come out of nowhere.
 * Warcraft has so many "getting crap past the radar" moments combined eith Deus Ex Machina characters that then get sucked into the lore that Chen Stormstouts (the first real Warcraft panda) existence seems rather normal

Web Comics

 * Lampshade Hanging: In Questionable Content the cast are trapped in an alley by a crazed Knight Templar / Anti Hero and her robot Sidekick until they are saved at the last minute by their own robot sidekicks under the battle cry "Deus Ex Machina!". QC, one should note, is set in a slightly-warped version of the real world, somewhere between Mundane Fantastic and a sci-fi or Superhero world.
 * In an apparently unintentional lampshaded example, Miranda of Dominic Deegan has taken to calling herself "Deus Ex Momina," being a rather jarring Parent Ex Machina in what is neither a sitcom nor starred by a teenager. Word of God states the joke was her terrible delivery of the joke rather than being one of the most Meta Guy moments the comic's ever had. There are other events where this happens, sometimes even being mentioned by the cast. ""
 * Justified: Sluggy Freelance features a literal Dea Ex Machina who is not a literary Deus Ex Machina in the "That Which Redeems" story arc. The goddess of good has been trapped in the Demon King's refrigerator since the conquest of her world, but as the story had been told within the comic years previously, her appearance was widely predicted by the readers. So when she's freed from the fridge and sets things right, no one's really surprised.
 * Also in that unsealing the goddess was a Torg's deliberate goal that he struggled and sacrificed for, whereas a Deus Ex Machina is by definition easy and out of nowhere. This is really more Sealed Good in A Can (though if it were a can instead of a leaky ziplock, we'd be short several plotlines).
 * The "Holiday Wars" arc plays with it and doubly subverts the Deus Ex Machina. We learn that there exist three magic "Deus ex ova", Latin for "God from the eggs", magic eggs created by the Greek gods that will hit the Reset Button if broken, and that Bun-Bun's main antagonist Santa Claus has one of them. Finally, when Santa is left with no other options, he tries to use it, but . Later,
 * The end of 'Oceans Unmoving' literally has a god from out of nowhere, or at least his blood relative. While the sudden appearance of the brother of a Time God living in the basement of a timeless dimension is thematically consistent, he really seemed to appear just in time to wrap up the storyline quicker. Bonus points for wrapping the continuity to the beginning of the series though, and explaining Bun-bun's appearance without revealing any mysteries about his past.
 * This is lampshaded, since Uncle Time automatically assumes that Bun-Bun solved his riddle, which led him there. Bun-Bun has never even heard of the riddle or Uncle Time, despite all of the lore and myths that the story invokes.
 * The plot of Errant Story is kicked off when Meji casts a spell to invoke a Deus Ex Machina so she can find a way to complete her senior project and graduate from wizard school. As a result, she accidentally discovers, in the school library, the only surviving copy of a book that contains some information that the elves were trying to keep secret. Oddly, despite the name of the trope being mentioned, this is not a normal example of the literary trope, because it serves to drive the plot rather than resolve it.
 * The Adventures of Dr. McNinja hangs a lampshade on this here.
 * T-Rex explains it in his inimitable style here.
 * The resolution of the sexual harassment subplot in Something Positive.
 * Fits to a tee, but not the first time it's happens. So at least the author can claim he didn't completely pull out from nowhere.
 * Schlock Mercenary on several occasions. Also lampshaded here.
 * Order of the Stick: The MitD plays this role in this comic. While the Monster in the Darkness is a mystery to everyone except Rich Berlew; this new ability introduced comes right out of nowhere and at the most convenient of times for our heroes. The fact that it also reunites them back with their friends does not help.
 * There is Wild Mass Guessing that it can do that because it has Wish as a spell-like ability. However, almost all creatures with such abilities are Outsiders, which have oddly-colored Speech Bubbles in Order of the Stick. The MitD has normal Speech Bubbles.
 * Seeing as different Outsiders have different speech bubble colors and OoTS is exactly the sort of series that would use Medium Awareness as a plot point, it's fully possible that MitD is just a kind of creature that uses Speech Bubbles that are white with black text and outlines.
 * Note the earlier statement that most such creatures are Outsiders, not all such creatures.
 * Also note that the MITD's ability was previously hinted at, albeit subtly.
 * Subtly hinted at here as well. This strip doubles as a CMoH if true.
 * This comic also features something that is hard to accept at face value (no air turbulence and coincidence). It's deliberately played off under Rule of Funny so it is excusable, but still tastes like a Writer Cop Out. Receives Lampshading here.
 * Bob and George, where rather often various "convenient plot devices" were thrown in (to the point that even the author of the series himself became a regular cast member).
 * Parodied in Tom the Dancing Bug here.
 * In Game Destroyers, Ferahgo is a purposeful example of this, and Jipples has become a minor, though lazy, example of this as well.
 * Kevin and Kell has seen its fair share of these in its ten years or so as a comic, though one arc taking place during June of 2011 involving factional elections amongst rabbits comes to an end with a completely unexplained, contrived resolution that restores the status quo, just in time for the Dewclaw family to escape their latest conundrum. Made all the more jarring by their salvation in this situation spontaneously appearing and disappearing with no indication from where or why it came and left as it did.
 * Actually named in Gonewith the Blastwave.
 * In Sinfest, Lil' Evil complains to God that an event is one.

Web Original

 * In The Gamers Alliance, when Leon is about to die in battle, a black wolf appears all of a sudden and saves his life. It later turns out that the wolf was in fact Kagetsu I whom Leon had unknowingly freed earlier. Technically Kagetsu was only a half-god, though.
 * Lampshaded in The One Ring to Rule Them All 2. Frodo and Sam escape their lava trap with no other explanation than "plot device, Mr. Frodo, plot device".
 * Critics of the ending to Survival of the Fittest v1 tend to claim that the only reason that Adam Dodd won was a series of these. Others who believe that the alternate universe "Afterlife" RP signifies the existence of the supernatural in SOTF claim that the spirits of his dead friends may have been protecting him.
 * Played for Laughs in The Onion Sports Dome reporting a collapse of the Staples Center had brought an early end to a basketball game between the Los Angeles Clippers and the Phoenix Suns where the home team Clippers were in a losing end of a Curb Stomp Battle.
 * Averted during the course of The Dark Nella Saga with the jar of mayonaise. While it does allow for teleportation it was shown being injected with "a plot device" by Lord MacGuffin early on in the saga. The only remaining question is how Dr. Tease got the jar in the first place...
 * Chronicle Of The Annoying Quest features a character named "Dues X. Machina" (Pronounced "doose"). The name seems to be an ironic joke, however, as he doesn't actually do anything plot-related in his first appearance (though he does provide another excuse for hilarity to ensue...)

Western Animation
"Beast Boy: So are you magic now or something?
 * The end of the The Secret of NIMH film just screams Deus Ex Machina. Supposedly, the "stone" that does something...powerful manages to respond to Mrs. Brisby's...emotion and then pulls the cinderblock out - with no loss of life (or mud, which had been flooding the house). Auntie Shrew likely survived because she fell into a Plot Hole when the mud started flooding the house.
 * This was clearly meant to be a Chekhov's Gun given Nicodemus' earlier line "Courage of the heart is very rare...The stone has a power when it's there." However, given that the power is never specified, it qualifies as a Deus Ex.
 * May be Fridge Brilliance though; the stone represents all that the rats have been trying to achieve - a higher level of existence and independence, maybe even obtaining supernatural powers (although that may be too far out).
 * The stone was given to Mrs. Brisby by Nicodemus. He's got mysticism and uncertain yet mighty power all over the place when he's on screen, even before we fully see him. It would be a shocker if the stone wasn't profoundly magical in some way that Nicodemus failed to mention.
 * Parodied in an episode of American Dad; just when Stan and his family are about to be stoned to death, George Bush and the army arrive to save them with the line "Democracy has arrived!", throwing an American flag through the judge. Instantly, all of Saudi Arabia becomes some kind of democratic paradise, and Stan gives a line parodying the end of Its a Wonderful Life. However, none of it mattered in the end, as it was All Just a Dream.
 * Though a real Deus Ex Machina took place in the form of Roger using his "husband"'s (long story) apparent political influence to call the Saudi executioners just in time to call off the stoning and free the Smiths.
 * Megas XLR got most of its humor from the fact that the titular Humongous Mecha was a literal Deus Ex Machina. In fact, one of the numerous buttons on its control panel was even marked "Save the World" (which was actually missing).
 * More often it was subverted as whatever was supposed to be a Deus Ex Machina of the episode backfired or misfired and the thing that ends saving the day turns out to be a seemingly unimportant plot element from earlier in the episode.
 * Spoofed in the Christmas Special Olive the Other Reindeer: Olive gets locked in the van of a mean-spirited mailman who wants to ruin Christmas. Her method of escape is contained within a box addressed "To: Olive From: Deus Ex Machina"
 * South Park: Mintberry Crunch of the Superhero arc, full stop.
 * Parodied on The Simpsons in an episode where Homer is the only person called up to Heaven after the Rapture; when he asks God to put things back the way they were, God raises His hands skyward and shouts "Deus ex machina!", after which everything goes back to normal.
 * Another episode sets up the ending like this is the only way out. Homer and a little girl are trapped on a tiny island in the middle of the lava - on a tiny island in the middle of the ocean - and we're just waiting for the rescue helicopters or something equally incredible to save them. But the show suddenly stops and some commentators laugh and wonder how they're going to get out of this one. And by the way, it's Pledge Drive Week, so phone in now... (The show is intentionally left unresolved.)
 * Don't forget the Lord of the Flies parody episode where all the kids are left stuck on the island at the end and James Earl Jones, in a voiceover narration role, says that they were eventually saved by "...oh, let's say, Moe".
 * Played for Laughs in The Simpsons Movie, where Maggie shows up to defeat the villain completely out of nowhere.
 * That infamous episode where Bart & Lisa help a homeless man win a lawsuit against Itchy & Scratchy studios. Itchy & Scratchy gets back on its feet thanks to two kids named Chester & Elisa.
 * The Aladdin TV series hung an enormous lantern in the form of a Parental Bonus: One episode involved the hunt for the "Orb of Machina", a MacGuffin intended to cure Genie's cold.
 * At the end of the Transformers Generation 1 episode "A Prime Problem", Megatron throws Spike out of his rocket, but then Powerglide shows up out of nowhere and saves him. It could be assumed that he was there all along and simply hadn't appeared on screen, except for the fact that before this episode, all but two of the Autobots had had land-based altmodes.
 * Later, in Transformers Super God Masterforce, The Autobots are revealed to be equipped with non-lethal knockout gas just as Decepticon zombies attack Rome.
 * The SpongeBob SquarePants Movie writes itself into a corner that can only be rectified by a wonderfully ridiculous parody of Twisted Sister's I Wanna Rock. The villain's plans are undone by the explosive power of rock music. Once the smoke clears, SpongeBob is left dangling on the end of a rope suspended above the stage in a neat reference to the literal Greek tragedy deus ex machina.
 * Avatar: The Last Airbender series finale had a two for one special. Aang is Aangsting about what to do about Ozai so he consults his past incarnations. The majority vote goes to "Kill the bastard" but Aang, being an Actual Pacifist on account of Airbender teachings, holds out(despite that his Airbending predecessor advising him that he should Shoot the Dog). Then it turns out he was on the back of a lion-turtle all along, and it teaches Aang Energybending to stop Ozai without killing him.
 * It's a bit of a subversion because in "The Library" Sokka observes a picture of a Lion Turtle.
 * Camp Lazlo: Lumpus is riding atop his walking lawnchair the elves built him (don't ask). He has Santa, who is armed with naught but a tetherball, down on the ground (don't ask). Slinkman and the kids have failed in rescuing the jolly old elf and are lying in a heap. This looks like the end...'til Lumpus is hit by a meteor. There was mention of a meteor shower at the very beginning, but still.
 * And then another meteor shows up and narrates the ending a la the snowman from an early film version of Rudolph the Red-Nosed Reindeer. Just in case you were still wondering what kind of show this was.
 * Phineas and Ferb relies on several per episode as running gags to maintain the status quo. It is usually excused with Rule of Funny.
 * Perry and Doof in "Phineas and Ferb Get Busted".
 * Teen Titans loved doing this.
 * Season 3: Cyborg is the only Titan left who can resist Brother Blood's Mind Control. Blood has effortlessly torn Cyborg's leg and arm off, controlled the other Titans, and is ripping Cyborg's circuitry apart, trying to find the component that makes Cyborg immune. Cyborg announces "It's my SPIRIT!" instantly rebuilds a replacement arm and leg, ignores Blood's energy blasts (the ones that blew his arm and leg off 15 seconds ago) and takes Blood out with one punch.
 * They at least Lampshade Hanging it this time.

Cyborg: I'm sure it was a one-time deal."

"Blackarachnia: The history tracks never mentioned this!
 * And they explain the mechanic fine (Blood was trying so hard to use his Psychic Powers to control Cyborg's mind that he accidentally allowed Cyborg to access them). The problem was, they explained this after the fact, with no indication beforehand that something like this was possible or that Blood had anything but complete control over his powers. This is especially jarring precisely because it wouldn't have taken much foreshadowing to establish the mechanic beforehand. Sigh.
 * Season 4: Raven embraces the Power of Friendship, reverts to her normal age, and gains complete control of her powers long enough to blast her evil father into oblivion.
 * The finale of Beast Wars: the Maximals, holed up in the Ark, are getting pummeled by the Decepticon warship Megatron just found. Thanks to a tip from Dinobot II, they find a working shuttle in one of the bays, one that NO ONE knew about for the WHOLE SEASON they'd been living there. They take that shuttle, kamikaze it into the enemy ship, and then fly home on it, creating a Stable Time Loop.

Rhinox: History's still being made!"

"Buster: I was wondering how our hack writers would get us out of this one."
 * Actually, it's not a Deus Ex Machina. If you watch the of Optimal Situation, you can see the Maximals constructing an outpost inside of Mt St. Hillary out of scrap metal, but their only use of the Ark is piggybacking on its power systems. Presumably, they didn't want to screw with history anymore than they absolutely had to.
 * The Fairly Odd Parents Musical Episode: the loophole in Flappy Bob's contract that defeated the pixies isn't even hinted at until the final act.
 * Winx Club: In the tenth episode of season 2, Bloom discovers her healing powers when she brings Sky back from the dead.
 * In Tiny Toon Adventures How I Spent My Vacation, Buster and Babs are saved from a fatal fall by a plot hole (a literal hole in the ground, that magically transports them back home).

"Norbert: Where in the name of Deus Ex Machina did that T-REX come from?!"
 * Several Earthworm Jim episodes ended with very blatant examples, all operating under Rule of Funny. An example is when Evil the cat unleashed a Monster Clown Cosmic Horror that was unstoppable. Jim calls an Obstructive Bureaucrat, who demands the Cosmic Horror obtains a license to destroy the universe, the stacked-up application form for which extends above the atmosphere. Which must be filled in in triplicate of course. This is discounting the many times were the bad guy is beaten, somehow gets back into power in the last few seconds, then gets hit by the falling cow.
 * Invoked in Re Boot. Mainframe is damaged beyond repair and there's nothing anyone can do to stop the system from crashing and killing everyone. Bob's "last resort" is to backup everyone, let the system crash, and pray for a system restart from the user. Sure enough, the User restarts his computer and saves everyone, including the people already killed before the crash.
 * Before Cerebus Syndrome, an episode about Hexadecimal changing all of Mainframe to stone concluded with Hex deciding she was bored and snapping her fingers to de-petrify everyone. Admittedly, it took a little prompting from Bob. And it is Hexadecimal...
 * This one is excusable. Hexadecimal's main purpose is to spread chaos, and while the Medusa bug was causing chaos at first, the end result was order. Bob merely pointed this out to Hexadecimal and that was enough to make her delete the bug.
 * THE CLAW at the end of Toy Story 3 is a literal Deus Ex Machina, given that the LGMs treat "the claw" as their deity and it is also the machine that  Its arrival is accompanied by a choir of angelic voices on the soundtrack.
 * The ending of the Family Guy episode "Lois Kills Stewie". No, before we find it out it was a simulation. When Stewie is about to shoot Lois, she is saved when he is shot by Peter... who was last seen on the couch at home.
 * Many of Doug's problems were solved in this way. Some examples include being able to wear a mask at the party to cover a pimple because it's a costume party and his video that he doesn't want Patti to see actually going to Mr. Bone.
 * Transformers Prime has an episode titled Deus Ex Machina. In it the B plot of Miko caught by a security guard is wrapped up by Agent Fowler suddenly showing up to solve the problem. Miko even explains how the trope works just before Fowler shows up to execute it.
 * The 90s Fantastic Four show has "Where Calls Galactus", where Galactus decides to consume Earth after allying with the Four against a common enemy. All seems lost...
 * It should be noted that the episode is based on a comic book arc by John Byrne, and it makes much more sense in the original.
 * A few episodes of Angry Beavers turn out to be this, with special mention for Moby Dopes. Dagget brings home a killer whale to their pond, thinking it to be as kind as Willy, but is really a carnivorous beast eating everyone and everyTHING in sight. It looks like it's about to be the end of the beavers... until a T-rex comes in and eats it. Norbert even lampshades this.



Real Life

 * The shinpu (in English, "Divine Wind", also known as "kamikaze") were a set of typhoons in the years 1274 and 1281 which prevented Mongol invasions of Japan.
 * Note: Typhoons in that area only happen once in a thousand years.
 * Likewise, two of the worst winters in Russian history were the years that Napoleon and Hitler invaded Russia, and the harsh weather were big factors in their defeats.
 * Actually they were rather mild winters, they just came unseasonably early. Also the Russians destroyed their own supplies to deny the enemy the use of them, and hit supply lines very hard.
 * The Russian term for it is General Winter. He defeats a lot of enemies.
 * The "Protestant Wind" is a name used for two extremely unlikely yet valid incidents. One is the storm which wrecked the Spanish Armada in 1588, saving England from a Spanish invasion (Spain being a Catholic country, hence "Protestant Wind"). The other is the bizarre wind patterns that allowed William III of Orange to successfully invade England and depose King James II in the "Glorious Revolution" of 1688. (James II was a Catholic, which his subjects did not like, and William was a Protestant. Again, "Protestant Wind".)
 * Inverted(in that France is considered Catholic): Joan of Arc was trying to gain entry into Jean de Dunois's war counsels, but Dunois blew her off because a wind "which had absolutely prevented the ships in which were the food supplies for the city of Orleans from coming upriver." But then in that moment "changed and became favorable. From that moment I had good hope in her, more than ever before." Not only did the Siege of Orleans end up being considered Joan of Arc's greatest victory, Dunois thereafter became one of her biggest fans.
 * Deus Ex Machina basically gave America the win for quite a few battles in some pretty important wars.
 * Funnily enough, one of the occurs after a priest prays for favorable conditions. Your Mileage Will Vary as to whether this is meaningful or not.