%% This list of examples has been alphabetized. Please add your example in the proper place. Thanks!

%% Image replaced per Image Pickin' thread: http://tvtropes.org/pmwiki/posts.php?discussion=1321642353075040200
%% Please do not change or remove without starting a new thread.
[[quoteright:304:[[ComicStrip/TomTheDancingBug http://static.tvtropes.org/pmwiki/pub/images/godman_2061.jpg]]]]

->''"Coincidences to get characters into trouble are great; coincidences to get them out of it are cheating."''
-->-- '''Emma Coats'''

A Deus Ex Machina ([[LatinPronunciationGuide pron]]: Day-oos eks MAH-kee-nah) is when some new event, character, ability, or object solves a seemingly unsolvable problem in a sudden, unexpected way. If the secret documents are in Russian, one of the spies suddenly reveals that [[SuddenlyAlwaysKnewThat they know the language]]. If a protagonist [[LiteralCliffHanger falls off a cliff]], a [[GiantRobotHandsSaveLives flying robot will suddenly appear to catch them]].

The term is Latin for "god out of the machine" and originates in [[OlderThanFeudalism ancient Greek theater]].[[note]]the original classical Greek "theos ek mekhanikos" became "deus ex machina" through Latin translations of Greek literary criticism in the Renaissance[[/note]] It referred to scenes 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.

Note that there are a number of requirements for a sudden plot development to be a Deus Ex Machina:
# Deus Ex Machina are ''solutions''. They are never [[DiabolusExMachina unexpected developments that make things worse]], nor [[AssPull sudden twists that only change the understanding of a story]].
# Deus Ex Machina are ''sudden or unexpected''. This means that even if they are [[ChekhovsGun featured or referenced earlier in the story]], they do not change the course of nor appear to be a viable solution to the plotline they eventually "solve".
# The problem a Deus Ex Machina fixes must be portrayed as ''unsolvable or hopeless''. If the problem could be solved with a bit of [[IdiotBall common sense]] or other type of simple intervention, the solution is not a Deus Ex Machina no matter how unexpected it may seem.

The concept eventually came back into vogue during the early years of the film industry thanks to UsefulNotes/TheHaysCode. Villains, and anyone else who didn't toe the moral line, were absolutely not allowed to get away with their crimes. But, more often than not TheVillainMakesThePlot and EvilIsCool. [[GettingCrapPastTheRadar The solution]] was to let the bad guy be awesome for the duration of the movie, then [[DroppedABridgeOnHim drop a bridge on them]] in the last five minutes.

Remember, even the notorious Deus ex Machina [[TropesAreTools can be pulled off]]. Sudden resolutions are perfectly capable of leading to satisfying conclusions - see the entire "[[RuleOfIndex Rule Of X]]" series of tropes: RuleOfCool, RuleOfCute, RuleOfEmpathy, RuleOfFun, RuleOfFunny, RuleOfRomantic, RuleOfScary, RuleOfSexy (for those ever-so-fun {{Deus Sex Machina}}s), RuleOfSymbolism, and ''especially'' RuleOfDrama. Apparent Deus Ex Machina also happen plenty in [[TruthInTelevision real life]], given reality is far more complex and random than most fictionalized versions of it. Not to mention that a DeusExMachina short of the climax is a ChekhovsGun; if the saving force complicates the story afterwards, it's the introduction of a new element.

Compare to the ResetButton, NonProtagonistResolver, DiabolusExMachina, CoincidentalBroadcast, YouDidntAsk, EurekaMoment and SuspiciouslySpecificSermon. Not to be confused with the tropes DeusEstMachina or AveMachina. Nor the works ''VideoGame/DeusEx'', ''VideoGame/DeusExInvisibleWar'', ''VideoGame/DeusExHumanRevolution'', ''Manga/DeusExMachina'' or ''Comicbook/ExMachina''.

''Also'', please make sure an example meets '''all 3 criteria''' before submitting. This is a not a place to [[Administrivia/ComplainingAboutShowsYouDontLike Complain About Plot Twists You Don't Like]].
!!Examples (Warning: Ending Spoilers)


[[folder:Anime and Manga]]
* The final episode of the ''Manga/AngelSanctuary'' OVA is about as literal an example of this trope as it gets.
* In ''Manga/AsatteNoHoukou'', Karada and Shokou are able to [[spoiler: switch back to their original ages]] when [[spoiler:Kotomi gives them a second wishing stone]], which she had never previously mentioned or hinted at having. This, of course, didn't happen in the manga.
* ''Manga/{{Bleach}}'' has [[spoiler:Aizen's final defeat]] because of NewPowersAsThePlotDemands. [[spoiler:Aizen has proven to be increasingly invincible against the strongest members of the cast]], Ichigo scores a new, never before mentioned power, and utterly destroys him. For good measure, [[spoiler:Urahara had secretly invented a sealing Kido just in case that didn't finish Aizen off, and he started regenerating back to full strength.]]
** And when that still didn't work, he randomly lost all of his powers because reasons. According to Ichigo, [[IJustWantToBeNormal he just wanted to be normal]].
** Earlier, Ulquiorra unleashes his resurrection and completely curb stomps Ichigo. He then reveals that he has a second resurrection that Ichigo is utterly helpless against, resulting in Ulquiorra killing him. Suddenly, Ichigo revives as a super strong hollow creature that tears Ulquiorra apart. It's not even clearly explained afterwards how Ichigo's hollow was able to bring him back to life.
** Much later, after the death of [[spoiler:the Soul King]], one of the relatively minor secondary characters suddenly reveals that they've had the solution to the problem the entire time, with virtually no preamble, foreshadowing, or buildup.
* In ''Manga/CardcaptorSakura'', ThePowerOfLove 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 SequelHook, 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. Another example 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.
* ''Manga/DetectiveConan'', Conan can do ''anything'' at given times from riding a motor boat, a helicopter, and shooting guns with a common excuse of "My dad taught me that in Hawaii". The movies happen to be much more action oriented compared to the cases seen throughout the show where you'll only come across action related content during episodes/arcs related to the Black Organization. The good news though is that the Hawaii excuse is only ever used throughout the non-canon movies so in regards to Gosho Aoyama's manga, this copout doesn't overlap with the source material.
* In ''Anime/DragonBallZ'', 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 fanfic.
** 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.
* ''Anime/TenkaiKnights'' the [[spoiler: Tenkai Wolf]], a creature who'd never been mentioned before (and had the flimsiest foreshadowing ever) suddenly appears and easily defeats the [[spoiler: good and evil halves of the Tenkai Dragon]] before they're fighting inadvertently destroys the planet.
* ''Anime/EurekaSeven'' grants us the wonderful moment where the protagonist ''magically creates'' a [[NewPowersAsThePlotDemands new, super-powerful unit]] out of thin air by [[AC:ThePowerOfLove]]!
* Played straight (and literally) in the last few volumes of ''Manga/FushigiYuugi''. Taka buys Miaka a pager. [[spoiler:Suzaku then ends up taking up residence, essentially, in the pager, so that he can contact his priestess.]]
* Mic Sounders of ''Anime/GaoGaiGar''. His Disk P ThemeMusicPowerUp 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 [[spoiler: can produce a Gao Figh Gar armed with the Goldion Hammer]] 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.
* Batou is saved from certain death in ''Anime/GhostInTheShellStandAloneComplex'' by an extraordinary literal example.
* Somewhat lampshaded in ''Manga/{{Hellsing}}'' where the giant zeppelin of the MagnificentBastard Major is called the Deus Ex Machina- appropriate seen as how it appears from nowhere to bomb London.
* In ''Manga/InitialD'', when Takumi battles the Todo School's rally driver with the School's demo car at Happogahara, he is absolutely going to lose [[spoiler:until a cat jumps out in front of the Civic just before the final corner. When the driver swerves to miss it, Takumi passes, not seeing the cat because his lights were off.]]
* ''Manga/JoJosBizarreAdventure'':
** A major sticking point with fans at the end of Part 3 is Jotaro's [[spoiler: spontaneous development of Time Stop]] 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 [[spoiler:move during Dio's Time Stop]].
** Another one comes at the end of Part 5, when Giorno fights Diavolo. Giorno is [[spoiler: pierced by the Requiem Arrow]], and his Stand Gold Experience gains the ability to [[spoiler: ''negate any action taken by an opponent.'']] Stands had been shown to develop new abilities thanks to the arrow before, but that power is ridiculously broken.
** Part 2 eventually has the BigBad Kars becomes ''immortal'', being able to survive being roasted alive in a volcano and being able to curb stomp the good guys. Joseph admits his defeat as the battle is truely hopeless and he's run out of plans... then Kars's finishing move gets bounced and amplified by the [[McGuffin Red Stone of Adja]], creating a giant volcanic eruption and along with other things being tossed that launch him into the outer space, where he is ultimately frozen alive and floating around the universe for eternity.
* ''Manga/MahouSenseiNegima'':
** Halfway through the GeckoEnding of the first anime, after [[spoiler:Asuna's [[IronicBirthday birthday party]], [[MoodWhiplash sudden death]], [[ReallyDeadMontage funeral, and cremation]], and Negi's [[FiveStagesOfGrief desperate]] search for a way to bring her back to life, [[TeenGenius Chao Lingshen]] and [[MadScientist Hakase Satomi]] reveal that they have a TimeMachine]]. The [[spoiler:TimeMachine]] in question was a major plot device in the manga's Mahora Festival arc. While it was a major {{Asspull}} for those who only watched the anime, for those fans familiar with the manga it was somewhat closer to a ContinuityNod.
** Another example is the end of the Kyoto Arc, where the Negi party was saved from the BigBad and the Demon God he [[SealedEvilInACan unsealed]] by the equally demonic unsealed [[PersonOfMassDestruction Evangeline]].
* ''Anime/MartianSuccessorNadesico'' tap-dances across this trope in the final episode. To get the Black Box out of Mars, a specific link is needed to get it activated. In this case, a kiss. Yurika, however, is more willing to blow the **** thing up as it's the cause of all of their troubles. Akito goes after Yurika and is able to stop her and tells her that he was finally able to watch the final episode of ''Gekiganger III''... [[spoiler:and was incredibly dismayed when he found out the final episode had Joe, whose poignant HeroicSacrifice mirrored the loss of Akito's friend Gai, come BackFromTheDead with the original Gekiganger III to save the day. He points out that those things can't happen in real life and we shouldn't expect them. Which is hilarious as he finally kisses her, the teleportation works and, apparently, their first admiral was actually still alive and rejoined the gang.]]
* A borderline case appears in the second season of ''Anime/MobileSuitGundam00'': with the forces of [[spoiler:Celestial Being]] about to be defeated, [[spoiler:Setsuna, who has been slowly undergoing Innovation (a cornerstone of the show's ongoing GambitRoulette), finally achieves it. This, in turn, triggers a hidden system of his machine, the Trans-Am Burst, which spread on a much larger scale the effects the machine was already known to have (healing, telepathy, etc). Given that TheChessmaster had already been established to have built-in hidden subroutine in his mobile suit to be triggered as his roulette demanded, and that it's shortly thereafter that a world-wide mind-meld was a key point of said roulette]], 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 FridgeBrilliance variety.
** And, before we continue to the next subject matter, this Deus Ex Machina in question also [[spoiler: somehow cured Louise Halevy of her particle poisioning, as she was about ready to succumb to her genetic breakdown. Depending on your viewpoint, this was the saving grace Louise needed after a hard couple of years, or you looked at the show [[KarmaHoudini basically giving her a free pass]] for the crap she did to thousands of innocents, her friends, her boyfriend, and even that person who was responsible for ruining her life, if you want to add her to the equation.]]
** 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 [[TheChessmaster 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. And as with the first example, it is extremely hazy to wether it is regular old Deus ex or a case of FridgeBrilliance catching up.
* In ''Manga/{{Naruto}}'', Sasuke pulls off a NoOneCouldSurviveThat by [[spoiler:summoning, mind-controlling, ''and'' teleporting a massive snake]] when he's completely out of chakra. Said technique is difficult because of the huge amount of chakra required. 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 [[spoiler:Pain/Nagato pulls a case of RedemptionEqualsDeath and a device that was only shown to be able to repair corpses to bring back [[DeathIsCheap everyone]] that he had killed since entering the village]].
** During his assault on the Kage Summit, [[spoiler: Sasuke]] nearly died from chakra exhaustion, having been spamming the crap out of high level techs with his new [[spoiler: Mangekyo Sharingan]]. And then, out of nowhere, [[spoiler: Zetsu, who had previously shown up to alert the Kages to Sasuke's presence and gotten killed for his efforts, reveals that he managed to use a time release jutsu in the split second before the Raikage snapped his neck that sucks all the chakra out of everyone in the room and gives to Sasuke.]]
** [[spoiler: [[BigBad Obito]] and Kabuto]] both become examples, as each pulls a HeelFaceTurn, helping to revive Naruto and Sasuke respectively.
** [[spoiler: Obito died, but turns out his eyes have the power to teleport the user from the afterlife back to the land of living as a chakra ghost, and then he passes both his Sharingan to Kakashi ''using chakra transfer''. Mind you the Sharingan is a [[SuperpowerfulGenetics bloodline limit]] and his physical eyes were both destroyed when Kaguya desintegrated his body. And then Kakashi fully manifests a Susanoo [[InstantExpert in its stabilised perfect form in the first try]]. This isn't even getting started on the fact that Kakashi is able to use the Uchiha bloodline technique Susanoo, despite the fact that he, you know, ''isn't an Uchiha''.]]
** Towards the end of the story, all hope seems lost. Madara [[spoiler: successfully rips Kurama out of]] Naruto, basically killing him and [[spoiler: giving him the opportunity to become the Ten Tails Jinchuriki.]] ''Then'' he stabs Sasuke through the chest, and nobody is able to save his life. [[spoiler: Except for the Sage of Six Paths, who pulls Naruto and Sasuke into his private limbo, gives them some important exposition, and then hands them the power to fight Madara and defeat Madara while also saving both of their lives.]] What a nice person.
* ''Anime/{{Pokemon}}'':
** Any 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. Metronome in the games is a completely random attack, selecting from a list of the majority of other moves in the game and naturally having a very high chance of doing something useless or detrimental. This never happens in the anime.
** 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 RandomNumberGod on its side. She got better about it, and later seemed to use it as a jump-off 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.
** 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.
** ''Anime/PokemonTheFirstMovie'' features Ash running between a beam struggle between Mew and Mewtwo that [[TakenForGranite turns him to stone]]. When a few shocks from Pikachu make it clear that [[TheHeroDies 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. Justified as in the prologue of the movie, it is explained that the tears of Pokémon contain life. This is also briefly mentioned in the movie itself. But only in the dub.
** The ninth movie has a similar occurrence where Ash suddenly gains what seem to be Manga/DragonBall powers to stop what would have otherwise been a villain victory. The original version had an unclear explanation and the dub added a ''slightly'' deeper level of justification.
** In ''Manga/PokemonSpecial'', Ruby can't penetrate through the lightning that a machine made to be able to defeat the {{Big Bad}}s. What does he do? The only logical thing, of course, call out [[spoiler:Celebi]], which doesn't make sense because [[spoiler:Celebi]] isn't more resistant to electricity than Swampert, but that's not all. Then [[spoiler:Celebi]] proceeds to use its [[spoiler:time powers to revive Norman, Steven, and Courtney. And Celebi's not even caught in a GS Ball, which the Mask of Ice needed a full blown out plan to get!]]
** 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.
** Another example 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.
** Pikachu defeating Brock's Onix because he Thunderbolts it while the sprinkler system is running. [[HilariousInHindsight Ironically,]] the video games would vindicate this years later with the introduction of the "Soak" move, which changes the target's typing to pure Water, [[ElementalRockPaperScissors with the predictable results]]. Of course, Pikachu can't learn Soak, but using the sprinklers to soak Onix in a more literal sense is a fair stand-in.
* Justified and subverted in ''Anime/PuellaMagiMadokaMagica''. 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. [[spoiler: It turns out, however, that she is a Time Traveller and had repeated the same span of time over and over again, knowing what events were to happen and when the events would occur. With her power over time, she could appear when it is thought to be very unlikely.]]
** The resolution of the series is sometimes considered to be this trope, but it was {{foreshadow|ing}}ed earlier. Kyubey claims in episode 8 that [[spoiler:Madoka could wish to become a god, and could easily "make Sayaka human again" (an ominous choice of words, since this is ''before'' Sayaka becomes a witch). [[AbstractApotheosis Madoka does exactly what he suggested, and decides to cure all the other witches, too.]] [[BeCarefulWhatYouWishFor Not an ideal result for Kyubey, but it's his own fault for encouraging the idea]]]].
* A literal Deus Ex Machina is attributed to everyone's survival after the FinalBattle of ''Manga/RaveMaster.'' This despite several characters using a DangerousForbiddenTechnique to win their battles. The characters theorize that since they saved the world, the world decided to save them back.
* ''Manga/RozenMaiden'' was CutShort 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 was more [[EnigmaticMinion 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 ''Manga/RozenMaiden'' anime's second season, Traumend, also ends with a major Deus Ex Machina. [[spoiler: All of the dolls are defeated in the Alice game, and Barasuishou becomes Alice. Just when everything looks lost, she suddenly starts to crumble apart. This is explained along the lines of "she can't handle the purity of Alice", or something like that, as she's not really a Rozen Maiden. The dolls killed by Barasuishou come back to life. Those killed by legitimate Rozen Maiden stay dead.]]
* A staple of the ''Anime/SailorMoon'' anime. Two notable instances would be all the heroines dying only to be randomly resurrected; and the heroine throwing herself from a floating island, then inexplicably sprouting wings on the way down.
* ''[[Manga/{{Saiyuki}} 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.
* ''Anime/{{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.
* Played absolutely straight in ''LightNovel/{{Slayers}} NEXT''. Nearly the entire plot revolves around Lina's [[HoldingBackThePhlebotinum 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 ResetButton by bringing everyone back to life that Phibrizzo had killed (Lina's breaking point about casting the spell was his threat to [[DeaderThanDead obliterate their souls as well]]).
* ''Anime/SonicX'' 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 nothing about this earlier in the series.
* Used in the ''Manga/SoulEater'' anime adaption's final episode where [[spoiler:Kid's lines of Sanzo connect and grants him godlike Shinigami powers]]. When this fails and Maka is knocked unconscious with even her weapon, Soul, incapable of helping her, [[spoiler:she suddenly begins to conjure scythes out of her body because she happens to be half weapon. This ability has never been heard of before now and best believe it'll never be brought up again]]. When even this fails. [[spoiler:Maka manages to beat him all on her own using none other than The Power Of Love.]]
* [[Anime/TengenToppaGurrenLagann Gurren Lagann]] did this over and over... sort of. Essentially a "logical" Deus Ex Machina was set up for the show's entirety with Spiral Energy, literally giving characters the ability to do the impossible ([[spoiler:the chance of Kittan's giga-drill that freed the crew from the spiral-draining sea thing succeeding was given as 0% but through a great speech and shouting he succeeded]]) 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 this too often can ruin a series").
* Occurs in all three installments of the ''Franchise/{{Transformers}}'' Unicron 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 ''[[Anime/TransformersArmada Armada]]'', then by Primus in ''[[Anime/TransformersEnergon Energon]]'' and ''[[Anime/TransformersCybertron Cybertron]]''.
** In an earlier series, this is what saved Star Saber from Deathsaurus in ''Anime/TransformersVictory''. 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 ''Manga/TransformersZone'': 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.
* ''[[Anime/UchuuSenkanYamato Star Blazers]]'': ''The Comet Empire War''; The near-Godlike Treleina of Telezart turns up at the very last moment to [[spoiler:obliterate Prince Zordar's warship and save Earth.]] Subverted as Captain Wildstar had already begun the process of [[spoiler:sacrificing the Argo in a ramming attack]] to achieve the same end.
* At the end of ''Manga/WolfsRain'', [[spoiler: after Darcia defeats and kills all the major cast members and prepares to enter paradise, he is suddenly vaporized (except for his eye) for no apparent reason, other than he's evil.]] This comes off as a bit of an AssPull for some.
* The heroes in ''Anime/YuGiOh'' 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?
--> '''[[WebVideo/YuGiOhTheAbridgedSeries Yami Yugi]]''': I activate "Deus Ex Machina"!
--> '''[[WebVideo/YuGiOhTheAbridgedSeries Weevil]]''': ([[WesternAnimation/BeavisAndButthead Beavis-esque voice]]) Hee hee! Hey! No fair! You can't use spell cards on my turn!
--> '''[[WebVideo/YuGiOhTheAbridgedSeries Yami Yugi]]''': Tell it to the writing staff!!
** In the duel between Yugi and Mai in the Duelist Kingdom arc, Yugi wins by playing "Black Luster Ritual", which allows him to summon a more powerful monster than anything Mai has. Yet for some reason, only Yami is even aware that Yugi has it in his deck; Yugi has never heard of the card before.
** 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 [[spoiler:draw six more cards. And, as it turns out, these were exactly what he needed to pull off a very specific combo attack to deplete Noah's 10,000+ life points.]] If not for ThePowerOfFriendship scene just before, that draw would have been ridiculous even by Yu-Gi-Oh standards.
** [[SerialEscalation Taken even further]] in the duel against Leon in the filler tournament arc. Thanks to the BigBad 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.
** Kaiba's winning move against Zigfried in the same arc qualifies too. By using Zig's own Magical Alms card against him with a great deal of luck, he's able to draw five new cards, increase his Life Points enough to spend the amount needed to banish five of his Dragons and then summon ''all five'' of them, then launch an attack that blows Zig's monster to Kingdom Come and Zig's Life Points to zero. (And it was likely the most spectacular finish of Kaiba's career.)
** 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. [[RuleOfCool (But it was kick-ass awesome.)]]
** 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.
** If anything, all of this can be chalked to pre-emptive DiabolusExMachina, that is, the opponents drawing into what they need first to push the protagonists into a bind, for the sake of RisingConflict.
* ''Anime/YuGiOhCapsuleMonsters'' has a literal example. When Yami is injured in the fight against the Five-Headed Dragon, the girl chosen as a human sacrifice prays for the Blue-Eyes to aid him, joined by the other villagers. It awakens and aids Yugi.
* The card "Miracle Tuner - Savior Dragon" ("Majestic Dragon" in the dub) from ''[[Anime/YuGiOh5Ds 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 (the 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).
* In ''Anime/YuGiOhArcV'' Yuya being able to Pendulum Summon right out of the blue, Yuya is the first and only person to be able to Pendulum Summon and the only one with Pendulum monsters. People accuse Yuya of cheating being the only duelist who can do so. Leo Corporation remedies this by developing their own Pendulum Summoning.
* ''Manga/YuYuHakusho''
** Yusuke winning Genkai's tournament could apply. Ignoring the fact he was lucky enough to have Kibano [[ExplainingYourPowerToTheEnemy tell him about his helmet]], the [[Bowdlerise/AnimeAndManga edited]] {{dub|InducedPlotHole}} qualifies because it [[NoSmoking 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.
** Another one from the Dark Tournament: Kuwabara is in a fight that he knows he has no chance of winning (for reference, he was screaming in pain on his way ''into'' the ring) and is planning to kill them both with a suicide attack to win, (his team has four wins and the other only has two, so a double win will bump them up to the necessary five). Suddenly, [[LoveInterests Yukina]] arrives which [[ThePowerOfLove somehow]] restores Kuwabara's energy and he knocks his opponent across the stadium with one shot.
** From Chapter Black, Yusuke's fight with the Doctor contains ''three of these in a row.'' The first, and most random, happens when the Doctor takes a female nurse hostage [[spoiler: who turns out to be [[VoluntaryShapeshifting a disguised (and sickly) Yanigisawa]] who manages to save himself.]] The second happens when he tries to fool Yusuke with a false antidote to his plague [[spoiler: which gets ruined by the sudden appearance of [[{{Telepathy}} Murota]] (also sickly).]] And the final one happens when Yusuke seemingly kills the Doctor (as the only way to stop his plague) [[spoiler: [[WriterCopOut only to have Genkai revive him.]]]]
** There's also Hiei [[ChangedMyMindKid deciding to help]] ''precisely'' when Sniper blows up the truck. This one had been foreshadowed by Kurama, who had declared that [[JerkassWithAHeartOfGold Hiei]] was just posturing when he said he wouldn't help, and was proved right when Hiei got a flimsy justification and entered the frame.
** Also Yusuke being resurrected after being killed by Sensui due to being a descendent of a powerful demon king. Afterwards Sensui was still stronger and more experienced with his level of power and Raizen takes over Yusuke's body to completely dominate Sensui who at that point was dominating the fights before.
* ''Manga/HunterXHunter'' is a repeat offender of Deus ex machina, but one of the most striking examples is Alluka. She is a literal machine (machina?) of this trope. She has a special power that can supposedly do anything (the limits of this ability are unknown by anyone InUniverse, but Illumi speculated that there is probably 'no limit'). "It" never uses the ability itself, and only uses it when someone asks for a wish. There are strict rules regarding how to use the ability, and there are drawbacks in the form of a backlash, which can be trivial or severe, depending on the magnitude of the wish. Alluka was first introduced (with no hint of prior existence aside from confirmation that Killua had additional siblings that had yet to be introduced) after [[spoiler:Gon sacrificed his aura to defeat Neferpitou and was left in a state of near-death with little chance of being revived through 'normal' means. Obviously the only point of bringing this character into the manga was to [[ResetButton heal Gon and pretend that nothing ever happened]]. This is a wish that was expected to have an extremely major backlash that could potentially end up killing the entire Zoldik family, but, of course, it turns out that Killua can break the established rules for no reason and "command" Alluka to give any wish without any backlash]].
* In {{Planzet}} the day is saved when the protagonists stumble onto a [[spoiler:SuperRobot that was hidden until it was absolutely necessary. Its origins are never explained.]]

[[folder:Comic Books]]
* ''ComicBook/{{Hellblazer}}'': Played literally in the series. One of John Constantine's signature and most powerful magics is synchronicity wave travelling, an ability he inherited from his bloodline as the Laughing Magician. This allowed him to literally make his own luck, reshape the battlefield to his own accordance, and be in the right place at the right time. It's very helpful when the demon Nergal tries to hit a dazed Constantine and his wife on the road (who have just finished their time-travelling adventure). John's wave travelling automatically sets in, and the car suddenly skedaddles and falls over a cliff.
* Parodied in Creator/PhilFoglio's mini-series ''ComicBook/AngelAndTheApe'', where Sam Simian works as a comicbook artist drawing a series called "Deus-ex-Machina Man".
* Used in Creator/GrantMorrison's run of ''Comicbook/AnimalMan''. [[spoiler:Morrison himself shows up in the final issue of his run, titled "Deus Ex Machina", to explain to Buddy that he's just a comic book character, with no free will at all. Buddy gets pretty angry, for good reason, but eventually calms down, and asks about his family, who were all killed. Morrison decides that he can't come up with a good enough reason to keep them dead, so he just tells Buddy to go home, where he wakes up, and it was all a dream. But Morrison's run was all about toying around with the fourth wall, so it doesn't really come out of left field as one might expect from the above description.]]
* Franchise/{{Batman}} [[CrazyPrepared often solves situations by just happening to have a gadget on hand.]] Back [[TheGoldenAgeOfComicBooks when he killed people,]] Batman once confronted a Doctor Doom who threw a grenade at him. Batman then shielded his and Robin's body with [[http://i.crackedcdn.com/phpimages/article/5/8/2/100582.jpg?v=1 this.]] It's not even a gadget.
* Webcomic/BioApocalypse has a [[spoiler: literal example of this, with God sending the Angel of Death to abort a 50 mile tall fetus, after the space fleet failed to destroy it]].
* In a certain ComicBook/TheCreeper story Ryder's psyche gets unbalanced which [[spoiler:releases Creeper as a separate creature and several other Creeper-like monsters]] to plague the city and this problem is suddenly resolved when [[spoiler: due to some sort of metaparadox a god-like giant Creeper from different time and planet emerges from the original Creeper and collects all escaped monsters. He stores them inside the Creeper again and makes Ryder and Creeper shake hands and make up their internal fight.]]
* A short ''WesternAnimation/DonaldDuck'' comic tells of Huey, Dewey and Louie out on a mission for the Junior Woodchucks, when they run into Tachyon Farflung who puts them under his spell with the new hypnotism helmet he has just invented, telling them about how he'll use it to force Scrooge to hand over his money to him. Their solution? "Us Junior Woodchucks are ''trained to resist'' hypnosis!"
* Utterly lampshaded in ''Comicbook/{{Fables}}'' spinoff ''Jack of Fables'', whose characters include the Literals, {{Anthropomorphic Personification}}s 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 FourthWall 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 will be wiped out by a surprise legion of Nebularian attack cruisers, because otherwise, how would they win in 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 is decided that it is impossible to permanently stop the BigBad.
* Franchise/{{Superman}} builds a literal Machina with the Miracle Machine in ''Comicbook/FinalCrisis''.
* In the Comicbook/GothamCentral story arc ''Dead Robin'', the MCU needed to contact Batman. One problem though: they no longer had the BatSignal. Then it was revealed they had a never mentioned, [[Comicbook/BlueBeetle Ted Kord]] created, high tech portable Bat Signal. Josie Mac lampshaded this by saying it was very "Convenient".
* ''[[ComicBook/MyLittlePonyFriendshipIsMagicIDW My Little Pony: Friendship Is Magic]]''
** Issue 8. The protagonists cannot use the Elements of Harmony against the villain, but never fear, as their friendship suddenly and arbitrarily [[PowerGlows "lights them up from the inside"]] for no reason whatsoever, which proves just as effective.
** In the end of the "Reflections" arc, the heroes have managed to cast a spell that will permanently imprison the alternate-universe evil Celestia in crystal, but it will inevitably imprison the good Celestia too. All seems lost... until the good King Sombra saves the day by draining the "evil magic" from his universe's Celestia and Luna, thus making them non-villainous. The "evil magic" was never mentioned before, let alone the fact that he could do something like that.
* ''WesternAnimation/ThePowerpuffGirls'' #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.
* The ''Comicbook/SamAndMaxFreelancePolice'' 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. There's also Sergeant Blip and the Rubber Pants Commandos, they are almost a Deus Ex Machina incarnated; they only appear to save Sam & Max of whatever. 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 [[RemembertheNewGuy Ratso, Sam and Max' octopus pal]].
* Parodied in the third volume of Comicbook/ScottPilgrim (even more hilarious when you realize it was actually a ChekhovsGun):
-->'''Scott Pilgrim''' - "I can't even get near him! I need some kind of... like... [[LampshadeHanging last minute, poorly-set-up Deus Ex Machina]]!!"
-->[[spoiler:Vegan Policeman (to the villain) - "FREEZE! Vegan police. You were caught eating gelato this morning."]]
* The Marvel Character, TheSentry, 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 is expected to be there to save the day.
* Lampshaded word for word in the Franchise/SpiderMan 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 ItMakesSenseInContext), by the [[EmpathicWeapon disembodied tentacles]] of the long-dead Doctor Octopus.
* Done ''absolutely straight'' in an issue of [[Comicbook/SubMariner 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 Flemish comic series ''Comicbook/SuskeEnWiske'' has as one of the main characters Jethro, an [[GentleGiant 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 AppliedPhlebotinum to solve the situation the heroes are stuck in.
* The Mirage ''Comicbook/{{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 [[RuleOfCool 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.
* In the "Caged Angels" arc of ''Comicbook/{{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 BadassNormal and until then did not have any kind of immunity from PsychicPowers. 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. Though if Wolverine isn't immune to PsychicPowers when he has an adamantium skull, then Bullseye shouldn't be either.
* Franchise/{{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: [[spoiler:The Mooks accidentally used knockout gas. The cold water woke Tintin up.]]
*** Tintin and Snowy fall off a cliff: [[spoiler:he falls on a branch sturdy enough to support his and Snowy's weight yet capable of breaking their fall. Said branch is also conveniently next to an opening on the cliff face that leads to a cave to the surface.]]
*** Tintin is ChainedToARailway: he is saved when [[spoiler:a passenger on the oncoming train pulls the emergency brake for a completely frivolous reason.]] As the newspaper headlines put it: "MIRACULOUS ESCAPE!"
*** TheDragon uses explosives to create an avalanche on the cliff Tintin is climbing: [[spoiler:he finds a depression in the cliff to take cover in.]] This one is a bit milder, but a few pages later:
*** Tintin is dropped into an industrial meat grinder: the oblivious factory workers [[spoiler:go on strike and stop the machines ''at that precise moment''.]]
*** Tintin has [[CementShoes weights tied to his feet]] and is thrown in the lake: [[spoiler:the weights were inexplicably switched with ''wooden hollow weights'' used by a random fraudulent strong man act.]]
** Taken to new heights in ''Flight 714'' where after a dastardly hijack-revenge plot, Tintin and Co. are saved by [[spoiler:telepathic space men, of all things. To be fair, the existence of aliens and the fact they would go to the saucer was said by their human contact some pages earlier.]]
** 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. To keep the plot going, these moments of tension need to be resolved quickly.
* In an early story in the Marvel ''[[ComicBook/TheTransformers Transformers Generation 1]]'' comic, all the Autobots but Ratchet have been killed by Shockwave, who has gone on to [[TheStarscream 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...
* Justified by the TimeTravel plot in ''Comicbook/UniversalWarOne'': [[spoiler: the heroes are saved by invincible warriors coming from a civilization they will create in the past.]] It is one of the very few examples of a plot-relevant ''deus ex machina''.
* Lampshaded, referenced by name, and eventually [[spoiler:{{Subverted}}]] in ''ComicBook/{{Watchmen}}'' when Dr. Manhattan appears following his DeusExitMachina so that Laurie can "Try to convince [him] to save the world."
-->'''Dr. Manhattan''': Now, I believe we have a conversation scheduled.
-->'''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...
* ''ComicBook/{{WITCH}}'' had one in the third arc, when the [[BigGood Oracle]] stepped in to stop the Interpol from finding out the girls' secret, and even [[LampshadeHanging said what he was doing]], [[InvokedTrope calling the trope by name]]. Then he had to explain that no, he wasn't God, just an observer that usually doesn't intervene but that just for once did an exception.
* ''Papyrus'' is notorious for this, sometimes bordering to {{Asspull}} territory. The [[EgyptianMythology Egyptian gods]] are sometime responsible, other it's some unforeseen factors. Some examples:
** Papyrus is turned into a BeastMan. [[EverythingsbetterwithPrincesses Théti-Chéri]] appeal to the gods so they can restore Papyrus back to human form. The gods demand something valuable in exchange. Théti-Chéri says she's willing to sacrifice her own life. Papyrus is restore to human and [[HandWave Théti-Chéri has been released from the gods with no consequences to her]].
** Papyrus challenges the god Sobek. If Papyrus succeed in surprising the Crocodile god, he will win the challenge. And he did, because his hair had turned white from an precedent ordeal and Sobek was completely caught off-guard. Sobek conceded victory and Papyrus's hair was restored to black.
** A [[ALoadOfBull minotaur]] was about to devour Papyrus. He's stopped and eaten by the Labyrinth (which is actually [[NightmareFuel a giant coral reef]] with CombatTentacles.) Somehow, the minotaur carelessly forgot the make-up of the lair he's been living-in for generations.
** The Gods erase everyone's memories and [[StatusQuoIsGod Status quo is restored]].
** BigDamnHeroes moments from the Pharaoh and [[TheCavalry his army]] or some unseen ally/friend who called for backup.
** Papyrus becomes the avatar of the Master of crocodiles. By sacrificing his eyes, Papyrus has [[InstantWinCondition the powers]] to save of all of [[AncientEgypt Egypt]] from vast armies of Libyan invaders. After the Master leaves Papyrus's body, it seems Papyrus will be blinded forever, but when he drops the Master's feather, his sights are magically restored.
** A miraculous unguent is found inside the pommel of Papyrus' sword and is strong enough to fully heal someone. Papyrus had the sword since the beginning of the series and accidentally found the unguent (dozen of stories later) at the most convenient time.

[[folder:Fan Fiction]]
* In ''[[http://rugratonline.free.fr/rrfan35.html The Great Pokemon Fight]]'', [[WesternAnimation/{{Rugrats}} Tommy]] is mortally wounded by [[Franchise/{{Digimon}} Greymon]] during a heated battle to save the Poke-Digital World... And just as Greymon tries to finish off Tommy, he, along with his army, then just disappeared. Like, poof, bye bye. Heck, the story even says that they just disappeared for no reason. No one even questions this as they were too busy on the dying Tommy. Then he dies, and suddenly, [[Franchise/{{Pokemon}} Mew]] comes out of nowhere and revives him. In total, there's ''two'' Deus Ex Machinas in the span of a minute.
* In ''Fanfic/InThisWorldAndTheNext'', [[Literature/HarryPotter Harry and Hermione]] are sentenced to the [[FateWorseThanDeath Dementor's Kiss]] for killing RonTheDeathEater. Instead, the Dementor ''[[MadeOfExplodium explodes]]'' and releases their life force, allowing them to [[PeggySue go back in time]]. A bit more Justified than other examples, serving as a plot device to ''start'' the story, rather than the more common use in ending it.
* In the season 4 finale of JakeEnglishsMysteriousTheaterOfScientificRomanceFromTheYear3000, after being rescued Zeus declares all the other plot threads to be resolved.
* ''Fanfic/KnowledgeIsPower'': There's not really any other way to describe Harry and Hermione being sent into the past by the ghosts of James and Lily when [[RocksFallEveryoneDies a ceiling falls on them]].
* ''Fanfic/MyLittleUnicorn'':
** The Uniforce. A force of good only unicorns with golden horns can summon to amplify their magic by shouting that they believe. It is never explained what it really is, why only golden horned unicorns can use it and how the Grand Ruler discovered it, but it is the main attack to kill all {{Big Bad}}s.
** Mystic Light, the finishing move of [[spoiler: The Grand Celestial Ruler]].
* Chillingly done in the Pokémon fic Fanfic/NoAntidote. [[spoiler: After realizing a poisoned trainer is completely an EmptyShell, a ghost Pokémon, under orders from Giratina, takes control. The motives claim to be for the benefit of the "Starter" Pokémon that unquestionably follow their leader but...]]
--> [[spoiler: ''Ghost Controlled Trainer'']]: This is the most fun we've had in decades!
* In ''Fanfic/TealovesSteamyAdventure'', the cast face a seemingly hopeless fight against a giant, mobile pear tree. Then, Fluttershy appears from nowhere (the narration just states that she was hiding behind a cart the entire time) and [[SummonBiggerFish summons a flock of fruit bats]] to take out the tree.
* Happens a bunch of times in Fanfic/TwilightSparklesAwesomeAdventure:
** The new lead guard [[MemeticMutation takes an arrow to the knee]] before he can shoot Twilight. This is in a setting where guns are the weapon of choice and no character is ever shown to have a bow.
** At one point Twilight notices a hatch in the ground with a ladder in it ''inside a broom closet'' which helps her avoid a [[SpaceIsAnOcean space shark.]]
** [[spoiler: Slenderman appears out of nowhere to save Rainbow Dash from the gay snake.]]
** [[spoiler: ADMIRAL Awesome comes BackFromTheDead to save the heroes at the end of the Last Part.]]
* ''Deus Ex Rannoch'', a minor ''Franchise/MassEffect'' fic where the Refusal ending is overwritten by a [[spoiler:hidden geth/quarian empire big enough to defeat the Reapers]].

[[folder:Films -- Animated]]
* The Disney film ''Disney/TheBlackCauldron''. While the cauldron is the first artifact and/or character introduced, the way it qualifies is how it takes out [[spoiler:The Horned King]]. 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 [[HandWave flimsy explanation]]. It is also highly anticlimactic, because the [[spoiler: King]] doesn't get to DO anything, despite being hinted as being a powerful sorcerer. Another is supplied by the witches, who [[spoiler: revive the person that jumped into the cauldron]]. 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?
* A literal case in Disney's ''Disney/TheHunchbackOfNotreDame'':
** The BigBad spends the movie on a reign of terror that he proclaims to be for a higher cause, sings a VillainSong 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 movie shows Frollo becoming gradually more unhinged. The gargoyle started to crumble under his feet, and he grabbed onto it to keep from falling, but it still detached from the wall. He could have been hallucinating the bit where it actually came alive.
* A semi-literal example is the WelcomeToTheRealWorld scene in ''WesternAnimation/TheLEGOMovie'', in which Emmett dives into the void to retrieve the Piece of Resistance and falls out of the model into the real world, where he sees a vision of the child playing LEGO... and his [[StopHavingFunGuys rather less fun]] father. He eventually manages to persuade the kid to give him the Piece and put him back into the story, with him zooming out of the portal [[HomageShot like Neo at the end of]] ''Film/TheMatrix''.
* An example in ''Disney/{{Mulan}}'' II, when it is employed in the original style as Mushu climbs into an idol of the Unity Dragon and makes supposedly divine pronouncements (punctuated with a bit of fire-breathing) that neatly resolve what has become a very tangled situation.
* The end of the ''WesternAnimation/TheSecretOfNIMH'' film just ''screams'' Deus Ex Machina. Supposedly, the "stone" that does [[MacGuffin 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 PlotHole when the mud started flooding the house.
* PlayedForLaughs in ''WesternAnimation/TheSimpsonsMovie'', where Maggie shows up to defeat the villain completely out of nowhere.
* Towards the end of ''WesternAnimation/SouthParkBiggerLongerAndUncut'', 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. [[ResetButton 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 [[spoiler: is sent to heaven where he is greeted by large-breasted angels.]]
* ''WesternAnimation/TheSpongebobSquarepantsMovie'' writes itself into a corner that can only be rectified by a wonderfully ridiculous parody of Music/TwistedSister's I Wanna Rock. The villain's plans are undone by the explosive [[ThePowerOfRock 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.
* The [[spoiler:healing tears]] at the very end of ''Disney/{{Tangled}}''. While the movie is different in many ways from the original fairy tale, this detail comes straight from the source material. [[spoiler:The fact that her healing powers were rather mysterious to begin with may also be a factor]]. However, nothing in the movie itself foreshadows it in any way.
** Unless you believe the theory that [[spoiler:the drop of sun from the intro IS the tear that saved Flynn.]]
* '''THE CLAW''' at the end of ''WesternAnimation/ToyStory3'' is a ''[[FridgeBrilliance literal]]'' Deus Ex Machina, as the DVD commentary points out, given that the [=LGMs=] treat "the claw" as their deity and it is also the machine that [[spoiler: saves all of the toys from burning in the garbage furnace.]] Its arrival is accompanied by a choir of angelic voices on the soundtrack.
* The Amnesia-inator in ''Phineas and Ferb: Across the 2nd Dimension'', as even though it was established that OWCA has been duplicating Doofenshmirtz's Inators, that one was never seen before in a previous episode. Likely PlayedForLaughs, though, especially with Doofenshmirtz's response of " I think I'd remember building something like that!" to probably suggest that the original backfired and gave ''him'' amnesia thus forgetting he built it.

[[folder:Films -- Live-Action]]
* At the end of the flimsily plotted ''Music/{{ABBA}}: TheMovie'', 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.'' [[http://www.youtube.com/watch?v=ReKzpMlb_zg ...Cue the trippy song sequence!]]
* Discussed in ''Film/{{Adaptation}}'', in which Charlie Kaufman (Creator/NicolasCage) is told by a screenwriting guru (Brian Cox) never to use a deus ex machina under any circumstances. Which leads Kaufman to employ it at a crucial moment at the end of the filmby turning it into a ChekhovsGuns instead.
* Infamously done in ''Film/TheAdjustmentBureau'', where the main characters are predictably surrounded with no escape. Realizing they're about to be separated forever or worse, they kiss passionately...[[OverlyLongGag 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.
* ''Film/{{Apocalypto}}'' [[spoiler: has (in a scene strikingly similar to the Lord of the Flies example) Spanish Conquistadores and Missionaries as this trope]], however for some people this carried UnfortunateImplications. Unless one knows their history and interprets the arrival of [[spoiler:the Conquistadores]] as not one for the hero, but as a DiabolusExMachina for all of them.
* In ''Film/TheApple'': Alphie, Bibi and their friends are surrounded by the forces of [[MegaCorp BIM]] and [[LouisCypher Mr. Boogalow]], when Mr. Topps - a completely new character - appears and apparently [[AscendToAHigherPlaneOfExistence whisks the good guys off to Heaven.]]
* In ''Film/{{Avatar}}'', the humans have all but easily laid waste to the combined Na'vi forces. What happens next? Well it seems that their god pulls a more or less literal example by sending all of the wildlife on Pandora to attack the humans.
* On the DVDCommentary for ''Film/TheAvengers'', Joss Whedon calls the Comicbook/IncredibleHulk a "Deus Ex Hulkina", showing up out of nowhere to help out the others at least twice in the movie. He justifies it by pointing out that if they showed every second of what the Hulk was doing, the movie would have gone far over budget. In fact, Mothership exploding in space and all minions dying in Earth [-WAS-] a blatant Deus Ex Machina.
* In the movie adaption of ''Literature/TheBadSeed'', 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.
* A spectacularly obvious version happens in ''Film/{{Beerfest}}''. After [[spoiler: the fifth member of the team, Phil "Landfill" is killed, his previously unmentioned identical twin brother Gil shows up, who's just as good, if not better, than Landfill was at drinking, and even asks to be called "Landfill" to honor his brother. One character even says, "It'll be like Landfill never left!"]]
* ''Film/{{Casino}}'': Though based on a real-life event, the [[spoiler:metal plate under the driver's seat of Sam's car comes across as this]].
* Semi-literal in ''Film/{{Contact}}'', where [[spoiler:after the original alien machine was blown up, we find out that a totally separate yet completely identical machine was built half-way across the world,]] 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 [[Literature/{{Contact}} novel]] the film is based on.
* ''Film/CoolWorld'' may have one of the worst. "Noid" (real person) Frank Harris is killed by "doodle" (cartoon character) Holli 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''.
* The 2010 remake of ''Film/TheCrazies'' pulls one 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.
* ''Film/DayOfTheDead2008'': The zombified Bud, despite being a zombie, [[spoiler: suddenly remembers how to shoot a gun and wants to help humans instead of eat them, and shoots a zombie attacking the lead character, letting her escape and kill them all.]] Towards the beginning of the movie, Bud explains that [[spoiler: he is a vegetarian]].
* In ''Day Watch'', the second film of the series based on the ''Literature/NightWatch'' series of books, ''[[spoiler:The Chalk of Fate]]'' is introduced [[spoiler:as a device for RewritingReality]].
* ''Film/TheDeparted'': The scene at the end where [[spoiler:[[Creator/MarkWahlberg Marky Mark]] kills Matt Damon]] seems to be a pretty clear example of #2. In fact, in the original film ''[[Film/TheInfernalAffairsTrilogy Internal Affairs]]'', [[spoiler:Wahlberg's character doesn't exist, and the film has a DownerEnding with the crooked cop being a KarmaHoudini (until the second sequel, at least). Naturally, Americans would insist on something just a tad more upbeat.]]
* The example listed in FridgeBrilliance comes from ''Franchise/DieHard'', where [[Series/FamilyMatters Carl Winslow]], who doesn't ever want to use his gun in the line of duty, shoots [[NotQuiteDead the suddenly-risen]] Karl from behind to save [[Creator/BruceWillis John McClane]].
* LampshadeHanging in ''Film/DodgeballATrueUnderdogStory'', where the [[spoiler:treasure chest that allows Vince Vaughn to not only save his gym, but buy out his competitor,]] is clearly labeled "Deus Ex Machina". An unusual example of a deus ex machina as a TakeThat: ExecutiveMeddling forced the creators to [[spoiler:change the ending from the heroes losing to them finding the aforementioned treasure chest]]. Hence the obvious LampshadeHanging. The director's commentary mentions a scene that was never shot that would've actually given the above example some foreshadowing and made it less of an example [[spoiler: when Vince Vaughn's character gets the idea to take the money White gave him for selling him his gym and bet on his team to win the game.]]
* In ''Dresden'' the protagonist and his love interest are holed up to avoid the carbon monoxide poisoning and fires, 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!
* The astonishingly horrific ending to the travesty of modern cinema that was ''[[Creator/SeltzerAndFriedberg Epic Movie]]'' when one of the characters found the remote from ''Film/{{Click}}'' and paused time to defeat the White *****, who had turned into Davy Jones.
* ''[[Creator/TylerPerry 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.
* The Creator/MichaelJFox 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 [[ChekhovsGunman the man who's marriage Mike helped rekindle]].
* ''Film/GeorgeOfTheJungle 2'' uses a #2 version for laughs. The villain has the heroes at gunpoint then begins arguing with and then insulting the narrator. [[TemptingFate Then he asks the narrator what he is going to do.]] It turns out the narrator is [[{{God}} the big man himself]] and a giant hand descends from the sky and carries off the villain while giving him a wedgie.
* In ''Film/GiveMyRegardsToBroadStreet'', the main conflicts are resolved by the protagonist [[spoiler: spotting the tape box just sitting on a bench, untouched (after 24 hours), then hearing a muffled cry for help from his employee, who is locked inside a maintenance shed. The protagonist is able to get in, retrieve the employee and listen to his explanation, get out, and report his success. At less than five minutes from the midnight deadline. His call is made to someone who then has to make ''another'' phone call to the people who ''need'' to know before midnight, someone whom the audience didn't know had the number. That call does get through before midnight.]]
* The Franchise/{{Godzilla}} films of the 1960s-1970s were notorious for this. The two most infamous examples are the "Flying Godzilla" scene from ''[[Film/GodzillaVsHedorah Godzilla Vs. The Smog Monster]]'' and Jet Jaguar somehow programming himself to grow to the size of Godzilla in ''Film/GodzillaVsMegalon''.
* Parodied in ''Film/HistoryOfTheWorldPartI'' when the horse with the MeaningfulName of "Miracle" manages to TimeTravel in order to arrive to save the hero.
* The god out of the machine that saved the protagonist in ''Film/TheHudsuckerProxy'' was fairly literally a god working in a big machine.
* Done also in ''I Wanna Hold Your Hand''. The 2 main characters end up missing Music/TheBeatles at the Ed Sullivan Show. But the Fab 4 (dressed as cops to escape the fans) end up getting in their car.
* Film/JamesBond 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 ''Film/LiveAndLetDie'' 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 Bond gadgets.
** Also, the watch laser that Bond uses in ''Film/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.
* The timely and stealthy arrival of the T-Rex at the end of ''Franchise/JurassicPark''. The ending of ''Film/JurassicParkIII'' is this too.
* The second installment of ''Film/TheLordOfTheRings'', The Two Towers. After watching Gandalf the Grey seemingly succumb to the Balrog, he reappears without any real explanation as Gandalf the White.[[note]]It is explained in the book -but it still fits.[[/note]]
* The ending of ''Film/TheLostBoys''; excusable under RuleOfCool, RuleOfFunny, and coming right on the heels of a DiabolusExMachina, after the villains had already been defeated.
* A literal example in ''Film/TheMatrixRevolutions''. 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".
* Lampshaded/subverted/amazingly executed in a triple entendre by Creator/WoodyAllen 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.
* ''[[Literature/TheMillenniumTrilogy The Girl With The Dragon Tattoo]]'': [[spoiler:the truck]]
* Used in ''Film/MontyPythonAndTheHolyGrail'', 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 ChekhovsGun in an UnwittingInstigatorOfDoom fashion.
* Parodied In ''Film/MontyPythonsLifeOfBrian'', where Brian nearly falls to his death, a passing UFO just happens to abduct him and then crash-lands shortly afterwards. Brian is fine.
* A very amusing one happens near the end of ''[[Film/TheNakedGun 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, [[KarmaHoudini it seems like he is going to escape]]. Just then, a lion appears out of nowhere and kills him on the spot. Drebin had earlier released a bunch of animals from the zoo.
* In ''Film/NationalTreasure'', the characters follow cryptic clues all over the world to discover a massive treasure hidden under Trinity Church, but only after the BigBad 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 BigBad into leaving them stranded, specifically because they had guessed that there would be a back door.
* Used magnificently in the climax of ''Film/OBrotherWhereArtThou'', 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.
* ''On Our Own'' ends with [[spoiler:Uncle Jack miraculously flying in on his plane to adopt the kids]], thus ending an otherwise unwinnable police chase in the middle of nowhere.
* In ''Film/RaidersOfTheLostArk'', Indiana Jones fails in his mission to stop the Nazis using the Ark of the Covenant, and its power kills them; Indy and Marian are saved from it by shutting their eyes. While not mentioned in the film, this trait ''is'' something that's mentioned in Literature/TheBible, so the writers have ShownTheirWork.
* One of the finer examples of the trope in film history can be found in ''Film/RobinHoodPrinceOfThieves'', 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 ChekhovsGun--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."
* Billy Preston's character in ''Film/SgtPeppersLonelyHeartsClubBand.'' He appears just before the end as a weather vane brought to life, then [[spoiler: brings Strawberry Fields back to life and basically sets the rest of the action back to the beginning of the movie]], all while singing "Get Back." Shame he couldn't have done something similar with the Beatles themselves...
* In ''Film/ShakespeareInLove'', [[Creator/WilliamShakespeare 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. 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.
* An example in ''Film/SkyHigh''. Medulla retaining his intelligence in baby form comes off as something like this.
* In ''Film/SixTheMarkUnleashed'', Elijah Cohen, the mysterious man of God, miraculously appears when the heroes are about to be killed by the Community's forces and takes them safely away.
* At the end of ''Film/TheSpanishPrisoner'', the protagonist has been betrayed by all his previous allies and is seemingly left without any options. The "Japanese tourists", mentioned in passing by Steve Martin's character in the middle of the movie and whom we never see otherwise, turn out to be secret agents who have been monitoring the situation the whole time and whisk our hero away to safety.
* ''Film/SpiderMan3'': [[spoiler:The butler suddenly revealing the true nature of Norman's death to Harry. WordOfGod states that he was supposed to be a hallucination, representing Harry's good side, but he's seen interacting with Harry in Peter's presence, who doesn't act as if anything's wrong. Perhaps you can make sense of it by assuming the butler does exist, but Harry hallucinated [[AFormYouAreComfortableWith his realization in the form of said butler.]]]].
* In ''Film/StrangerThanFiction'', Kay Eiffel [[spoiler: uses one to save Harold Crick. From his real death.]] This was foreshadowed from the beginning. But, given the overall plot, it could have been retroactively included by Eiffel to [[spoiler: foreshadow the one that she came up with at the end.]] Indeed, she even says she'll need to re-write other parts of the story to justify the new ending.
* ''Film/TransformersRevengeOfTheFallen'' has a classic example. When Devastator climbs the pyramid, Simmons [[spoiler: manages to somehow contact a nearby warship captain on a hand radio and convinces him to use a "railgun" super weapon. This weapon obliterates Devastator and yet was not mentioned previously in either of the two movies, nor was it used again. It seems like a pretty handy weapon to have and even of a superior technology to that of The Transformers. It also seems odd that it was not used again, since The Fallen stands in the exact same place only a few moments later.]]
** To a lesser extent, The Matrix of Leadership might also be considered a Deus Ex Machina [[spoiler: as near the end it is revealed that this tool which is used to power a super weapon, is also the only thing that can bring Optimus Prime (and Sam) back to life.]]
** An almost literal example of the classic meaning in ''Revenge of the Fallen''. When [[spoiler: Sam dies at the end of the film, he is pretty clearly dead. Resuscitation isn't working, the medic calls it, this is one downer of an ending as our hero is dead and gone. Then, we are suddenly transported to some sort of weird robot FluffyCloudHeaven, where the original Primes tell him he has earned the Matrix of Leadership, and he comes back to life.]]
* In the climax finale of ''Film/TheTraveler'', [[spoiler: Detective Black stumbled upon his daughter Mary's ghost and acquired a life-saving tip that can enable him to defeat Mr Nobody]].
* ''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 there's the sound of a bugler sounding "Charge", the Apaches disappear, and the settler exits his house, praising God. It turns out that [[spoiler: one of the Apaches had a bugle and they were just luring him out of his house]]. When the real cavalry arrives hours later, they find the man tortured to death.
* ''Film/UnderseaKingdom'', just like the many weekly serials around that time, is notorious for this. The end of each episode has a {{Cliffhanger}} but they rewrite part of the script to allow a CharacterShield. (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.)
* Played dead straight in ''Series/WizardsOfWaverlyPlace'' the movie with the Stone of Dreams, the MacGuffin that Alex and Justin spend most of the movie chasing.
* One of the oldest film examples from ''Film/TheWizardOfOz''. The heroes are cornered, surrounded by all the guards of the Wicked Witch of the West. The Witch herself, gloating in victory, lights the Scarecrow on fire and Dorothy tosses a bucket of water to put him out, some of it splashing the Witch. Lo and behold, ''water'' turns out to be the Witch's weakness and she suddenly begins melting for no explainable reason. And all those guards that were surrounding the heroes don't go on a RoaringRampageOfRevenge but instead [[AndThereWasMuchRejoicing are all cheering that she's dead]]. Makes one wonder why they didn't splash some water on her themselves if they hated her so much, or why the Witch kept such a lethal substance lying around in the castle.

* A frequent criticism of [[Creator/MarkTwain Twain]]'s ''Literature/AdventuresOfHuckleberryFinn'', 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. Creator/ErnestHemingway famously referred to this ending as "cheating."
* At the end of [[Creator/DaveDuncan Dave Duncan's]] tetralogy ''A Handful of Men'', the heroes are in a totally hopeless situation. Thanks to his army of sorcerers with [[MindManipulation loyalty spells]] on them, the BigBad 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 PowerLevel higher than a sorcerer) who only avoided a SuperpowerMeltdown because his {{Love Interest|s}} managed to {{depower}} him before he burst into flames and died from it. Having been on the run from the BigBad throughout the whole series, the heroes have finally been captured and are about to be killed. They end up being saved when [[spoiler: two of the heroes achieve the PowerLevel above "sorcerer" without having a SuperpowerMeltdown by becoming a complete god instead of a demigod, and proceed to free everyone from the BigBad's [[MindManipulation Mind Control]] sorcery. Several of the main characters knew how to do this, but, normally, becoming a full-fledged god means that you AscendToAHigherPlaneOfExistence and simply stop caring about what happens to mere mortals, so it's never mentioned as a way to stop the BigBad until it happens.]]
* The Literature/AlexRider series follows the third way to the letter just like the James Bond movies. A teenage spy is sent into a mission with a small collection of gadgets. Of course he uses them all to save his own neck just in time and stop the current madman from destroying the world.
** Another one happens when Alex is running from some gunmen and ultimately runs to the rooftop of a building with no way down and the gunmen on the stairs. But then Alex remembers seeing a giant orange cone/construction equipment (not mentioned before) and jumps off the building into it, allowing him to slide from safety away from his assailants.
* ''Literature/ASeriesOfUnfortunateEvents'': LampshadeHanging and a DiscussedTrope in Book the Seventh. Violet, Klaus, and Sunny have been accused of murder and are in a jail cell that they have no chance of escaping from. It's Klaus's birthday, and he states that the one thing he wants more than anything is some Deus Ex Machina. A police officer shows up and grudgingly gives them some bread and water. [[MacGyvering Violet turns to Klaus and says "Happy Birthday..."]]
* Spike Milligan's ''Badjelly the Witch''. The eponymous witch is chasing the hero and heroine, who are fleeing her lair, when [[spoiler:''God Himself'']] intervenes. When she refuses to back down and tries to [[spoiler:blind him ''with her fingernails'']], he annihilates her.
* This happens almost constantly in the first book of Literature/TheBartimaeusTrilogy, where something coincidentally happens to save the titular character when he gets into a seemingly inescapable situation (managing to escape from captivity when a little girl crashes her bike into the bushes where he's being interrogated in).
* In ''Literature/{{Beowulf}}'', the Giant's sword that kills Grendel's mother was only mentioned moments before Beowulf takes it and kills her with it. She couldn't be harmed by weapons made by man, but she conveniently kept a sword crafted by Giants (which would be able to harm her) above the door.
* In ''Literature/TheBlueSword'' by Creator/RobinMcKinley, 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, [[spoiler: most of them die, and she gets super upset. She climbs to the top of a convenient cliff that wasn't there a minute ago, and uses her amazing magic powers that she didn't know she had to bring an entire mountain range down on the enemy army. Wouldn't it have been nice if she'd done that to begin with?]] Now, it was shown that Hari had some magic she was being trained in ''low-level'' magic!
* Intentionally but carefully used in the ''Literature/{{Chalion}}'' series, each book has one of the gods intervening in some dramatic and unexpected way to resolve the situation. {{Justified|Trope}}, since the gods have very restrictive limitations on how and when they can interact with the world, and usually have to keep their followers in the dark until the big moment in order to keep their plans from being derailed.
* In Creator/CSLewis's ''Literature/TheChroniclesOfNarnia,'' Aslan, who is a Jesus/God CaptainErsatz so it's not that surprising, spends the entire series behind the scenes, spinning the adventure and coming before them only when they need him most. He comes in during the last battle in ''Literature/PrinceCaspian'' to help the Narnians win after they began to lose hope.
* Anything by Creator/SimonRGreen, especially his ''Deathstalker'' series, lives and sustains itself on this trope. All of the heroes' asses must be sore from pulling plot devices and powers out of them.
* The end of the ''Literature/CircleOfMagic'' book ''Battle Magic'' ends Yanjing's invasion of Gyongxe with a literal Deus Ex Machina. Gyongxe really ''is'' the home of the gods and they've decided they're done with being invaded and conquered.
* The first Literature/{{Discworld}} book, ''Discworld/TheColourOfMagic,'' has some rather literal applications of Deus Ex Machina. There are two that are justified in that [[TheChewToy Rincewind]] is Lady Luck's favorite game piece in the [[CosmicChessGame tabletop RPG]] of the gods. Another at the end of the third chapter relies heavily on RuleOfFunny.
** Played with in the ending of ''Discworld/SmallGods'', which relies ''heavily'' on literal divine intervention; given the subject matter, however, it was rather a given. It also is the culmination of some heavy CharacterDevelopment ''by'' the god in question.
** ''Discworld/MonstrousRegiment'' plays the trope much straighter, which brought about much debate and anger from the readership.
* The reason why the final work of Creator/DavidEddings, the Dreamers Tetrology, was so poorly received was because every single book ended with the titular Dreamers having a dream that causes a natural disaster that destroys the enemy army. By the third book, ''the entire cast'' is fully aware of this fact, and knows that their job is to buy time until the next Deus Ex Machina solves all their problems. Then in the final book, another Deus Ex Machina turns up which causes the BigBad to have actually been defeated several centuries in the past, making the entire series technically never happen.
* In the eighth book of Creator/JimButcher's ''Literature/TheDresdenFiles'', ''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 [[ChurchMilitant Knight of the Cross]] Michael Carpenter, who has ContrivedCoincidence as a superpower. Harry's expectation is that the Almighty will protect His Knight's child out of professional courtesy if nothing else. When [[spoiler:Dresden's attempts to save her fail, Michael shows up, having saved the lives of some of the people out to kill her, who are required to spare her life in gratitude.]]
* A [[spoiler:[[{{Pun}} Draco Ex Machina]] conveniently kills the villains]] at the end of ''[[Literature/EarthseaTrilogy Tehanu]]''.
* ''Literature/TheEyeOfArgon'' has a beauty. Grignir, the barbarian protagonist, is locked in combat with a bunch of cultists. During the fight, one of his opponents just drops dead in the middle of the fight from an epileptic seizure.
* In Bulgakov's ''The Fatal Eggs'', an army of giant tropical animals is advancing towards Moscow, when they are all killed off by an unexpected frost. Bulgakov calls the chapter "A Frosty Deus Ex Machina".
* At the end of the ''Literature/{{Goosebumps}}'' book "How to Kill a Monster", the monster has the kids cornered and is about to eat them. But it turns out that the monster who survived ingesting drain cleaner, rat poison, ammonia and turpentine is allergic to humans and drops dead immediately after licking one of them.
* ''Literature/HouseOfLeaves'' has one, in which [[spoiler:Will Navidson inexplicably returns from the abyss inside the house after having been inside for several days with no food or water, or any real conception of where he was]]. Throughout the book, the House [[spoiler: only directly kills one person, with the other deaths all being a result of insanity. The house has a history of letting people escape its depths right before they would die of starvation or exhaustion.]]
* ''Literature/TheHouseOfNight'':
** Literally. [[spoiler:When Kalona kills Stark in Nyx's realm, the Goddess Nyx shows up and forces Kalona to bring him back to life.]]
** Happens again, in ''Awakened'' [[spoiler:with Nyx appearing at Jack's funeral to comfort Jack's boyfriend Damien, and to help the Raven Mocker Rephaim get over his demonic nature (by turning him into a boy at night) so he can truly love Stevie Rae]].
* Various gods interfere in the affairs of men all over the place in Creator/{{Homer}}'s epics ''Literature/{{Iliad}}'' and ''Literature/TheOdyssey'', often to save heroes they favour, especially Odysseus and Telemachus in the latter epic. The most egregious example in the ''Iliad'' is probably the duel between Menelaus and Paris, where Menelaus has Paris at his mercy only to have Aphrodite spirit him away, while in the final book of the ''Odyssey'' the intervention of Zeus himself defuses and ends the confrontation between Odysseus' family and the relatives of the dead suitors after just one man is killed.
* ''Literature/InheritanceCycle''.
** ''Eragon'': Murtagh's sudden appearance.
** ''Eldest'': the dance of the naked elf chicks to cure all of Eragon's ailments. And turn him into a half-man, half-elf instantly when the process is supposed to be slow and gradual and therefore gives him Rider skills and senses instantly rather than it taking years.
** ''Inheritance'': Basically everything. Seriously. The entire army of werecats appearing despite the fact that we've only met two in the past three books, the discovery of an essentially invincible anti-dragon weapon which had never been mentioned previously, Angela finding Albitr, the 'sharpest sword in existence', to save the heroes, the Eldunari on Vroengard having powers Galbatorix's far larger store never had, the unexplained 'carrying spell' the Eldunari teach Saphira, the very minor character form a previous book saving Roran in the final battle, then disappearing, the side-effects on the Varden's spellcasters randomly disappearing, Murtagh stripping all of Galbatorix's wards using a spell it is not stated Galbatorix ever risked teaching him and Arya and the elves emerging unharmed from the citadel which was just blown up, carrying the last dragon egg and ''several hundred'' Eldunari...
** The Dragons as a whole. The explanation actually given in the text is that no one knows how dragon magic works, it just does in times of need. Basically, Lampshade Hung with a massive neon sign. Here come the debates about whether they truly are a deus ex machina or just a very convenient plot device.
* {{Invoked|Trope}} and {{lampshade|Hanging}}d in the ''Franchise/StarTrek'' novel ''Literature/{{IQ}}'' 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... [[AnvilOnHead an anvil falls on his attacker.]] Q is quite disappointed with this largely because the Deus in question turns out to be an old enemy of his.
* In ''Literature/TheKiteRunner'', Baba's life is saved by a Russian soldier's officer suddenly appearing and [[BaitAndSwitchGunshot 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.
* Creator/LFrankBaum ''loved'' using this. Virtually all of the [[Literature/LandOfOz Oz books]] end this way. Sometimes there's an attempt at setting things up via ChekhovsGun, 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 ChekhovsGun, the Magic Belt Dorothy stole from the Nome king in a previous book, Ozma uses its power to dehydrate the army, whose invasion tunnel is conveniently right next to the fountain containing the Water of Oblivion, which makes anyone who drinks of it forget everything. The first thing the invaders do when they come out of the tunnel is drink the water; war avoided.
* The ''Literature/LeftBehind'' series ends with a Deus Ex Machina of sorts, though, given the philosophy put forth in the novels, this is probably intentional.
* Creator/CoryDoctorow ''loves'' this trope. In ''Literature/LittleBrother'', 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 ''Literature/EasternStandardTribe'' the protagonist just happens to become friends with a doctor at the asylum he is in who can and will free him.
* Most famously portrayed in "Literature/LittleRedRidingHood", with the woodcutter appearing out of nowhere to save her just in the nick of time; though he is established earlier in the plot, nevertheless he isn't following Red around to protect her, but pops up to kill the Wolf anyway.
** That's because in the earliest versions there was no woodcutter.
** In Creator/CharlesPerrault's version, the oldest written one, she's just eaten and that's the end of that. In French folk version, collected later but suspected to have been Perrault's source, she tells the wolf she has to go to the bathroom and slips off when she does.
** Ludwig Tieck's version, which predates ''Grimms' Fairytales'', follows Perrault, but because Tieck evidently did not like [[TheBadGuyWins the wolf getting away with eating the grandmother and Little Red Riding-Hood]], he added a passing hunter who discovers the wolf in grandma's house and shoots it dead. It was only Creator/TheBrothersGrimm or, quite likely, their source for their version, Jeanette Hassenpflug, who added the miraculous survival of the two victims of the wolf -- which looks as if it may have been modeled on "Literature/TheWolfAndTheSevenYoungKids". In later English versions of the Grimms' version the hunter became a woodcutter and he also was established earlier in the story.
* A literal example in ''Literature/TheLongDarkTeaTimeOfTheSoul,'' [[spoiler:when a god of guilt comes out [[ItCameFromTheFridge the oft-mentioned refrigerator]] to resolve the plot in five pages.]]
* Deliberately done in ''Literature/LordOfTheFlies'', where after [[spoiler: Jack sets the island on fire to kill Ralph]], a Navy ship shows up out of nowhere to rescue them, symbolizing how quickly the appearance of an authority can change everything.
* Steven Erikson's ''Literature/MalazanBookOfTheFallen'' has Dei Ex Machina galore. Some examples:
** The appearance of the titular Gardens in ''Gardens of the Moon''.
** The appearance of [[spoiler:the Trygalle Trading Guild]] in ''Deadhouse Gates''.
** The appearance of [[spoiler:the army of Bridgeburner ghosts]] in ''House of Chains''.
* ''Literature/TheMillOnTheFloss'' by Creator/GeorgeEliot. When Maggie runs off with Stephen and returns, she is shunned by her brother and has insulted Phil. While sitting in her cabin alone and brooding, a flood rips through the town and drowns her before she has an opportunity at reconciliation. References throughout the novel to the flooding of the countryside and water in general place this in the second variety.
* The entire plot of Creator/JulesVerne's ''Literature/TheMysteriousIsland'' is about characters trying to find out why and how someone bails them out of seemingly hopeless situations. (And that "someone", being [[spoiler: Captain Nemo]], does it in the [[BigDamnHeroes most dramatic manner possible]] all the time.)
* Averted in the ''Literature/TheNightsDawnTrilogy'' by Creator/PeterFHamilton. The threat to human civilization is so unstoppably powerful that, when evidence of an encounter with a ''literal'' god is discovered in the ancient records of an alien species, the humans are desperate enough to dispatch an expedition to track down this god and beg for its help. This subplot is even telegraphed in the '''[[ExactlyWhatItSaysOnTheTin title]]''' of the trilogy's final book, ''The Naked God''. As the result of all this lampshading, the story's resolution is neither sudden nor unexpected, and therefore ''not'' a DeusExMachina, even though it ''does'' involve direct intervention by a deity.
* Near the end of ''[[Literature/OldMansWar 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 Creator/JohnScalzi devoted the closing third of ''Zoe's Tale'' to explaining how exactly she got it -- it was ''much'' trickier than it looked from the outside.
* Throughout Creator/DavidWeber's ''Literature/OutOfTheDark'' the Shongairi invaders consistently lose ground battles to humans but [[DeathFromAbove 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 [[spoiler: the leader of the village they captured to experiment on turns out to be freakin' ''{{Dracula}}'' and he and a handful of newly-spawned vampires single-handedly wipe out the entire invasion force]]. Hints that [[spoiler: Dracula]] was present were scattered throughout the book, but were relatively subtle, and the reader is expecting a hard sci-fi war novel, and not [[spoiler: fantasy elements to creep in and sucker punch them]].
* ''Literature/ThePriestTheScientistAndTheMeteor'' has the title priest praying to God, resulting in a huge golden bat appearing that knocks the dinosaur-ghost ridden meteor out of the park.
* Bjorn Nyberg and Creator/LSpragueDeCamp's "The Return of Conan" has Franchise/ConanTheBarbarian'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, Creator/RobertEHoward, after Howard's suicide and the success of the character--wanted to imbue Conan with middle-class values, and making him more religious went along with that. Still, this is a textbook example: the god actually intervenes to save the hero. Particularly peculiar because elsewhere Crom only gives man life and will; everything else is up to the individual.
* In RaymondEFeist's ''[[Literature/TheRiftwarCycle Tear of the Gods]]'', the bad guy, "Bear", kills a bar girl somewhere around chapter 2. Her boyfriend vows revenge. The rest of the book happens, and the good guys finally manage to corner Bear. Unfortunately, they are unable to kill him because he is literally invincible and super strong. Suddenly, the god of vengeance incarnates in boyfriend and strikes Bear down. Good guys return victorious.
* Beginning with the novel ''Sahara'', author Clive Cussler has often written his heroes into impossible situations, whereupon a minor character shows up and gives them the assistance they need to continue - a minor character by the name of [[AuthorAvatar 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.
* Creator/GregEgan often uses characters motivated by religion (or other emotion-heavy ideology) to pop in, advance the plot by a sudden, violent action and never come back again. The most jarring example are the anachronauts from ''Literature/SchildsLadder'', who show up in the novel's climax to [[spoiler: blow up the research ship]]. They are only mentioned twice before, never shown to have any specific agenda, and their actions have no lasting consequences beyond isolating the two main characters to continue exploration on their own.
* Parodied to death and back in Suvi Kinos, where the little heroine's five uncles share a ''nom de plume'' and a serial story in a magazine which they write in turns. In a brotherly contest of wits, each uncle attempts to end their chapter in such a situation that the next in turn will have as much trouble as possible continuing. When the previous writer had left the story's heroine buried alive in a ridiculously secluded location, everyone was thrilled to read the next chapter, only to be let down with a blunt "''after she managed to miraculously escape, she had tea under the pergola''".
* Played painfully straight in Goodkind's ''Literature/SwordOfTruth'': Richard [[ItWasHisSled Rahl's]] Gift (basically magic) qualifies. At the end of a book, expect him to know how to perfectly use it to get out of the dire situation of the week, while at the beginning of the next book he's so clueless about how to use it that the events of the last book [[BagOfSpilling might as well have not happened]].
** Lampshaded somewhat at the end of ''The Pillars of Creation'' when one character asks Richard why he even needs the Sword of Truth after seeing his magic shred an entire platoon. Richard explains that his gift seems to work out of anger and need, whereas the Sword works all the time.
** Most notable in the [[spoiler:eighth book]], where [[spoiler:Richard]] is dying from being poisoned, with the only antidote down the drain and the only person who can make the antidote dead. He then uses [[spoiler:his Gift]] to reverse engineer the ingredients (down to the amount needed of each) of the antidote at the very last minute.
** Also notable at the end of the fifth book, when Richard realizes how to stop the bells, using a leap of logic that is nothing short of mind-boggling.
** Or the second book where Richard, without being aware he's doing anything of the sort, uses magical lightning to strike down all the enemy commanders and then any soldiers who don't surrender.
* ''The Thirteen and a Half Lives of Captain Bluebear'' includes a "Mac", a "Roving reptilian rescuer" who flies around the world, rescuing people from certain death at just the last moment. His full name? Deus X. Machina.
* In ''Bluebear'', at various points [[spoiler: Anagrom Ataf stands in the way of the Sharach-il-Allah, which leaves in accordance with rules of phenomena etiquette; some heavily {{lampshade|Hanging}}d improbabilities with a dimensional hiatus save him from a gigantic Spiderwitch; and Professor Nightingale turns up on a cloud of pure darkness. Really, only Mac and Rumo the Wolpertinger ''weren't'' Deus Ex Machinae.]]
* Creator/JasperFforde's ''The Well of Lost Plots'' -- part of the ''Literature/ThursdayNext'' 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. [[spoiler: At the end of the book, when a conspiracy that would have ruined all of fiction was coming to imminent fruition, Thursday activated the device and God came down and fixed everything.]]
* In the ''Literature/TortallUniverse'', the first ''Literature/SongOfTheLioness'' book ends with Alanna defeating the enemy with an ability that she has a flashback to learning in the same scene that she uses it, but this is probably due to the edits Creator/TamoraPierce had to do to the original manuscript.
* ''Literature/{{Twilight}}''. There are two main reasons in the first three books for why someone wouldn't want to be a vampire: first, the overwhelming desire for human blood, which is incredibly painful to resist, and second, a vampire's inability to reproduce. In Breaking Dawn, however [[spoiler: all these concerns are swept away when it turns out that actually, only female vampires can't have babies- male vampires have magical sperm- and therefore Bella is able to have Edward's child by having sex with him before being turned. And after the half-vampire baby starts eating Bella up from the inside and Edward turns Bella in order to save her life, it turns out Bella isn't horribly tempted at all, with a weak attempt at explanation in the form of "Well, she ''chose'' to be turned"]] Actually, Breaking Dawn is crammed FULL of this. [[spoiler: Bella whines for four books about being unable to survive without Jacob, her other prospective love interest, around, so in the fourth book he falls in love with her newborn baby and becomes part of her family, "where she always knew he belonged". ]] Oh, and the big one: [[spoiler: A group of powerful vampires, the Volturi are built up for three books as being the most powerful group of vampires around, but Bella's newborn vampire ability just HAPPENS to be able to completely defeat them without even a fight]].
* In ''Literature/TheWarOfTheWorlds'', the martian forces are almost unaffected by everything the humans throw against them, until [[spoiler: the entire invasion force is wiped out by an epidemic of ''[[WeaksauceWeakness the common cold]]'', which martian biology conveniently happened to have no immunity to.]]
** Justified in that the book is an allegory of European colonialism; thousands of European explorers and colonists really ''were'' killed by diseases that had little to no effect on the native populations.
* ''Literature/WarriorCats'': There are four instances in the first series where Firestar was about to be killed, but another character came by and killed/chased off whatever was threatening him almost instantly. Three of these four times, Graystripe was the one who saved the day.
** The main reason Firestar was able to win his fight against Tigerstar in ''Forest of Secrets'' was because Tigerstar slipped on some blood.
** For that matter, [[spoiler:Brambleclaw picking up a wooden stake and twisting around just in time to impale Hawkfrost with it as he was about to deliver his killing blow]] at the end of ''Sunset'' seems a bit ''too'' convenient.
* M.M. Buckner's titular ''Watermind'' survives everything the humans throw at it before being killed by [[spoiler: contact with salt water.]] Okay, there was foreshadowing, but getting it would have taken someone who was both better at science [[spoiler: (salt water being a better electrical conductor than fresh)]] ''and'' geography [[spoiler: (the lake they were driving the Watermind into being a tidal basin)]] than the protagonists, which takes ViewersAreGeniuses to levels that would make [[Manga/DeathNote Light Yagami]] throw up his hands in disgust.
* Richard Adams' ''Literature/WatershipDown'' has the rabbit protagonist saved by a human in one of the final chapters (appropriately named "dea ex machina"). Whether this is a true Deus Ex Machina is debatable, because the event is very logical from a human point of view, if not from a rabbit's.
** The "dea ex machina" chapter title reveals a further pun when the human savior arrives in a car--seeming to the rabbit literally a "goddess in a machine."
** A similar example comes earlier in the book, when the heroes cross train tracks safely, but their pursuers aren't so lucky. The rabbits take it for a literal Act of Frith (god), one unironically says something like, "You might think it's amazing to be saved by Frith, but it's really quite terrifying."
** If you thought that was an example, you have no idea what Adams is capable of. The first print of his third book, ''Literature/ThePlagueDogs'' ends as the [[TearJerker notorious]] film does, and the exhausted, starved, broken dogs plunge into the sea ahead of their hunters, and swim out in the vain hope of finding an island they've convinced themselves [[BlatantLies lies]] just over the horizon. In all subsequent editions of the book, the ''reader'' persuades Adams to do an AssPull and he does: two of Adams friends come by in a boat (while having a conversation about ''Literature/WatershipDown'' and anthropomorphism, no less) to pluck them from the sea and bring them back to the shore where the dogs owner (wounded instead of killed by the accident) is waiting.
* In Creator/HarryTurtledove's ''Wisdom of the Fox'', [[spoiler:the protagonists manage to trick the gods into solving the apparently impossible problem for them.]]
* ''[[Literature/ZeusIsDead Zeus Is Dead: A Monstrously Inconvenient Adventure]]'' has several gods as main characters, so this trope is perhaps unavoidable, but it's also lampshaded: At one point, when Apollo saves Leif, Tracy, and Thalia (one of the nine Muses) from the Erinyes, Leif comments that he doesn't mind being on the receiving end of a ''deus ex machina''. Thalia immediately laments the fact.
--> '''Thalia:''' Oh, gods! And on top of everything, now we’re cliché!
* In Creator/JamesThurber's ''Literature/The13Clocks'', 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''.
* Creator/JRRTolkien occasionally uses Giant Eagles to whisk his heroes away from danger. These aren't just at the end of ''Literature/TheLordOfTheRings'', but show up in ''Literature/TheHobbit'' to rescue dwarves from burning trees that are surrounded by wolves, to tip the scales in the book's great battle, and in ''Rings'' to rescue Gandalf from the roof of the Tower of Orthanc as well. Tolkien seems to have been unable to resolve the issue of characters marooned on top of high things as well as unable to resist putting them there. Whether these are a Deus Ex Machina is often debated:
** Tolkien called them a dangerous machine that he dared not use often with credibility. He thought them a deus ex machina, though in the books he justified them better.
** The Eagles are Manwë's messengers, so this is a legitimate case of a true Deus Ex Machina.
** ''Bored of the Rings'' had one of them stamped with "Deus Ex Machina Airlines."
** Common objections: The Eagles' place in Middle-Earth's greater cosmology that's AllThereInTheManual, 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 [[FridgeLogic raise]] serious [[PlotHole questions]] about [[http://www.angryflower.com/lordot.gif the story's foundations]].
*** As lots of people have pointed out however, the eagles would be easier seen by the Eye of Sauron, his Nazgul are riding winged beasts and as Tolkien writes eagles aren't always nice there is the possibility the ring could corrupt them.
** Throughout ''Literature/TheSilmarillion'' various characters are, like in LOTR, saved from almost certain death by a convenient Eagle, although here there is the explanation of it being literal; the Vala Ulmo (basically a god) teamed up with the Eagle Thorondor to aid the people of Beleriand against Morgoth, but due to the rest of the Valar shunning Beleriand Ulmo can only intervene in limited ways. Most of the novel is spent detailing the hopeless wars of the Elves and Men against Morgoth's forces. Conveniently the Valar then arrive to defeat Morgoth in time for the end.
** All of these are justified by the fact that Tolkien's works are intended to be a mythology; gods really do exist and intervene in the affairs of the world to achieve their desired results just like in Greek, Norse or any other mythology. Indeed, the Valar (the 'gods') intervene progressively less as time goes on, so that by the time of ''Lord of the Rings'', they've limited themselves to simply giving the protagonists an indirect nudge in the right direction.
** Also probably intentional, given Tolkien's own religious views. The mortals (Elves, Men, and Dwarves) tried to beat [[SatanicArchetype Morgoth]]) and failed. It took divine intervention to pull it off, fitting in with Christianity.
** The Istari (Wizards) themselves were slightly this, appearing about the time Sauron was starting to regain power. Jusified, the Valar couldn't directly intervene, so they send 5 Maia in human form to help rally the peoples of Middle-Earth against Sauron. This doesn't entirely work, as the greatest of the Wizards ends up [[TheParagonAlwaysRebels joining Sauron]], but ultimately it pays off due to Gandalf. What happened to the other wizards is another question...
* Creator/StephenKing
** ''Franchise/TheDarkTower'' series, which relied upon the conceit that King himself was [[LiteraryAgentHypothesis 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 LampshadeHanging moment, a character finds a note from King reading "DON'T WORRY; HERE COMES THE DEUS EX MACHINA!"
** ''Literature/TheStand,'' which inspired a limerick:
--->Oh, the Superflu caused so much pain, oh!
--->And with evil a raging volcano
--->Flagg's triumph seemed certain
--->Until King rang the curtain
--->By pulling a ''Deus ex ano!''
** Discussed in ''Literature/{{Misery}}'' with reference to a CliffhangerCopout. When Annie forces him to write another novel in a series he had ended by killing the protagonist, Paul Sheldon is forced to write a continuation that isn't one of these. The story references that Annie is familiar with, and ''hates'' this trope, and Paul needs to write the character back to life in a way that makes sense. He manages to cheat a little with NotQuiteDead, but the story ends up better for it.
* One ''Literature/RainbowMagic'' book had this. In Danielle the Daisy Fairy's book, the girls are completely incapable of retrieving the flower petal and are saved by a girl who happened to see what was going on.
* How many fairy tales have one of these? In multiple versions of "Literature/{{Snow White|AndTheSevenDwarfs}}" and "Literature/SleepingBeauty" (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. Literature/{{Rapunzel}}'s tears cure the prince's blindness. A hunter just happens to walk by Grandma's house as the wolf is attacking Literature/LittleRedRidingHood. Although it occurs midway in the story, there is also Literature/{{Cinderella}}'s fairy godmother.

[[folder:Live-Action TV]]
* On ''Series/{{Angel}}'', Lilah uses "Dead ex Machina" to describe the situation after Angelus tricks everyone into believing he was Angel again.
** Episode 3.19, "The Price", [[spoiler: the little demon slug things are all miraculously destroyed by a previously unknown and completely unexplored power of Cordelia's, that she managed to not figure out how to access earlier in the episode. [[NewPowersAsThePlotDemands Sure, we get that Cordy has new powers that we're still learning about,]] [[ContrivedCoincidence but they certainly lucked out that one of them just happened to be demon slug extermination.]]]]
** The power doesn't just exterminate demon slugs. It purifies darkness. Huge light = death to creepy monsters from "Darkest of the Dark Worlds".
* Subverted in the backstory of ''Series/BabylonFive''. During the Earth-Minbari War, the human forces lost every battle, without ever even managing to inflict significant losses on the Minbari. The Minbari's goal was nothing short of KillAllHumans, 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. At the time, this appears to the human characters be an incredibly blatant example of the trope; later in the series, it's revealed that [[spoiler:during the desperate last-ditch combat at the Battle of the Line, the ship bearing the Minbari Grey Council captured a human fighter and interrogated its pilot, discovering in the process that he carried a reincarnated Minbari soul. The obvious conclusion being that all the slaughter in which they'd indulged on their way to Earth was morally equivalent to internecine murder, the Minbari surrendered as the quickest way to put a stop to the killing.]]
** Played straight with the ending to "Deathwalker", the titular war criminal is headed to earth with a LongevityTreatment that uses HumanResources with the intent to throw the galaxy into chaos but every government wants it anyways. When a Vorlon (the only race whose ambassador that hadn't even bothered to attend the meetings about Deathwalker) cruiser pops out of the jumpgate and vaporizes her ship. While completely in character for the [[SufficientlyAdvancedAliens Vorlons]] there was no indication whatsoever that they even cared.
* ''Series/{{Batman}}'' with Creator/AdamWest. Lampshaded when their Bat-chopper gets shot down and they just happen to land on the mattress factory. "[[http://www.youtube.com/watch?v=XJlHjf_E--4 Hand me down the shark repellent Bat-Spray!]]" 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.
* ''Series/BattlestarGalacticaReimagined'' is full of them, more and more as the series progresses, and [[spoiler:it wraps up with a gigantic and very literal example, when God using his "angels" rescues everybody and takes them to a pastoral paradise]].
* ''Series/BuffyTheVampireSlayer'':
** Some fans would nominate the sudden appearance in "[[Recap/BuffyTheVampireSlayerS7E20Touched Touched]]" of a ForgottenSuperweapon in the sewers, immediately followed in "[[Recap/BuffyTheVampireSlayerS7E21EndOfDays 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 ([[HoldingBackThePhlebotinum 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.
** The amulet that appears at the end of Season 7 definitely qualifies.
* Children's light-drama series ''Series/BykerGrove'' had a spectacularly blatant example 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. HilarityEnsues as the characters write their dream endings, but forget to try to save the Grove until the last moment, when it is saved by [[TheDitz 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.
* ''Film/TheChristmasThatAlmostWasnt'': Santa and Whipple, having been convinced that the BigBad Prune has won, walk sadly down a street, hoping for a miracle; then, along comes a boy named Charlie, improbably dragging his last-minute Christmas tree down the same street Santa and Whipple are sitting, learns of their predicament and summons all the children on the street to contribute, lifting Santa and Whipple's spirits.
* Season 2 of ''Series/{{Dexter}}'' had a false one. [[spoiler:Doakes was inches away from being discovered being held captive by Dexter, and Dexter was rushing to intervene, only to discover the cabin had exploded, completing his attempts to frame Doakes as the Bay Harbor Butcher. Dexter actually refers to it as a "miracle" but later finds out Lila did it.]]
* ''Series/DoctorWho'':
** A ''literal'' example with Rose[[note]]well, technically it would be Ex Machin''am'', since it's ''coming'' out of the machine[[/note]] in [[Recap/DoctorWhoS27E13ThePartingOfTheWays "The Parting of the Ways"]], a mere human companion, opening the heart of the TARDIS (although with help from her mother and Mickey), to telepathically pilot it to the 2001st century to save the Doctor, absorbing the vast energies of the time vortex, emerging out of from the TARDIS as the "Bad Wolf" to save the Doctor from the Daleks. "The god out of the machine."
** In the episode [[Recap/DoctorWhoS28E13Doomsday "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.
** [[Recap/DoctorWhoS29E13LastOfTheTimeLords "Last of the Time Lords"]] 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 (not talking about [[TheNthDoctor that kind]]), de-aging, flight and a force-field) provided everyone in the world thinks the word "Doctor" at the same time. This one comes with consequences: [[TheWoobie Martha's family]], being aboard the ''Valiant'', were at the eye of the storm. The Year That Never Was still happened for them.
** In [[Recap/DoctorWhoS30E13JourneysEnd "Journey's End"]] there is the AssPull that suddenly the Doctor can stave of a regeneration by sending the excess energy into his hand. Then the human Donna touching it grows a new Doctor and when Donna is electrocuted by Davros just before the Daleks activate their Reality Bomb to destroy all Universes, she gains Time Lord intelligence and deactivates the machine, disabling Davros and the Daleks, though her mind has to be wiped of this or she will die. A common criticism of Russell T Davies is that he kept using these for his finales.
** 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 [[Recap/DoctorWhoS30E17E18TheEndOfTime "The 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 Loop}}s as well:
*** In [[Recap/DoctorWhoS31E13TheBigBang "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 Machina {{Stable Time Loop}}s 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. In fact, Rose's example above is another case of this: after obtaining godlike powers to stop the Daleks, she sends the words "[[ArcWords Bad Wolf]]" back through time to make sure her past self will follow the same path. In short, her "Bad Wolf" incarnation created itself.
** When you think about it from the perspective of a lot of the characters who only show up in one story, the Doctor himself is a Deus ex Machina. Think about it, these people are in the middle of a dangerous crisis, or in the early stages of one, and then out of nowhere, a strange blue box shows up. Then some guy and his companion(s) walk out and solve the whole damn problem.
** This is how TheNthDoctor got started. [[DoctorWhoS4E2TheTenthPlanet The story]] is concluded, but the Doctor ([[RealitySubtext and his actor]]) is dying. He rushes to the TARDIS, collapses, and then [[NewPowersAsThePlotDemands something completely insane happens.]]
** The concept is presented in ''Time Heist.'' [[spoiler: There is a bank that holds the universe's most valuable treasures, and as security the bank has an alien that can sense guilt (and killing those who are guilty of trying to break into the bank). In order for The Doctor and his group to succeed, they had to wipe their memories after planning the heist, so if they are caught they won't be guilty because they literally have no idea how they are going to do it and what it is they are looking for up until the point they find it. As such, the entire heist is a series of deus ex machinas, one after another, of plot devices that they planted before their memories were wiped]].
* ''Series/ICarly'' has Freddie invent a '[[MySensorsIndicateYouWantToTapThat 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 ''Series/ICarly'' standards, for some reason everyone in the show takes it at complete face value the instant they turn it on. A total example used as a lazy AssPull to setup a 5 part RomanceArc without having to go through any of that pesky character development.
* An episode of ''Series/{{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 [[DiabolusExMachina only makes things worse]] ([[spoiler:killing Boone, breaking Locke's faith, and fueling Charlie's drug habit]]). 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 ([[spoiler:although this later turns out to have been caused by Desmond]]). [[spoiler: Strangely, though, Locke's screaming actually stopped Desmond from committing suicide, so this was a real Deus Ex Machina moment after all]].
* ''Series/{{Medium}}'' had two Deus ex Machinas when Allison was faced with spiritual enemies: [[spoiler: The bad doctor (played by [[Series/BattlestarGalacticaReimagined Romo Lampkin]] is finally caught by (presumably) the spirits of his wife and his mother. The KnightTemplar stalker (he thinks psychics interfere with God's plan by catching criminals and saving people) is dragged to hell by the victims (almost two dozen in the space of about a week) of his psychic interference.]]
* Used repeatedly by ''Series/MontyPythonsFlyingCircus'' 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.
** 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 PlayedForLaughs.
* Planned but unused literal example: ''Series/MortalKombatConquest'''s finale has Shao Kahn having an army [[KillThemAll kill almost all of the good guys]], and [[TalkingToHimself gloating about this]] to the lone survivor Raiden. The plan was [[spoiler:that Shao had broken the rules, so the Elder Gods would push the ResetButton.]]
* When the time came for hosting duties to be handed over on ''Series/MysteryScienceTheater3000'', 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 ''Film/SpaceMutiny'', 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''.
* ''[[Series/PersonofInterest Person of Interest]]'''s Season 3 finale is ''named'' "Deus Ex Machina". [[spoiler:[[AvertedTrope Completely averted]] since the Machine does not pull something out of nowhere to save the characters, Samaritan goes online and begins to pass judgement on a large portion of Americans, Root's servers merely give Samaritan a blind spot to certain people (namely herself, her hacker squad, Finch, Reese and Shaw), the Library is abandoned and ransacked, and the last we see of our main characters are [[DownerEnding them parting ways with completely new identities. Greer wins and asks Samaritan what its commands for Decima are.]]]]
* In the finale of ''Series/PowerRangersInSpace'', [[BigGood Zordon]] pulls off an ICannotSelfTerminate suicide bomber attack that kills all the villains, transforms the redeemable ones into HumanAliens 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. [[TropesAreNotBad And it was]] [[DyingMomentOfAwesome awesome]].
* ''Series/PrisonBreak'' season four opens with Sucre, Bellick, and T-Bag somehow escaped from Sona. T-Bag could actually be explained, but not the other two.
* 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 CliffHanger ending, under the belief that they couldn't sell a show like that overseas. [[http://www.youtube.com/watch?v=mzZsI79jghI Video.]]
* The Series 1 finale of ''Series/{{Sherlock}}'' ended with a DiabolusExMachina (described on the Diabolus page) that set up a MexicanStandoff, creating a CliffHanger ending for that series. Said cliffhanger is ended within the first two minutes of the premiere episode of Series 2 via this trope. How was the standoff resolved? Moriarty, right before he can command his snipers to shoot Sherlock and John, receives a convenient business call from Irene Adler. He decides to leave to take care of this, and spares Sherlock and John completely on a whim as a result. (As Sherlock puts it, he "got a better offer.")
* In ''Series/{{Smallville}}'', Comicbook/LoisLane's "military connections" sure solve a lot of problems.
* ''Series/StargateAtlantis'' featured several Deus Ex Machinas in the form of the ''Daedalus'' ship.
* In ''Series/StargateSG1'''s fan-special ''200'', this trope (among others) is parodied and {{lampshade|Hanging}}d by the characters. The Deus Ex Machina comes in the form of the Asgard beaming the heroes out of danger JustInTime, which happened a few times in the show normal.
** Subverted in "Lockdown". The SGC has the bodiless Anubis running loose possessing people in an attempt to get through the stargate. Eventually, they try a plan meant to {{invoke|dTrope}} this on the part of the Ancients by trying to provoke Anubis to use his ascended powers, which would in turn provoke the Ancients by violating their AlienNonInterferenceClause. [[spoiler:It doesn't work; Anubis possesses the right combination of people to get through the gate.]]
* Happened in several ''Series/StarTrekTheOriginalSeries'' 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. This one is excusable considering the real drama of the story is that each side is confounded by the incomprehensible behaviour of the placid natives, only to be stunned when the superbeings finally show who is really in charge.
* The ''Series/StarTrekDeepSpaceNine'' episode "Sacrifice of Angels" is resolved with a Deus ex Wormhole. Sisko is faced with thousands of Jem'Hadar ships that are about to come through the wormhole, and is determined to take out as many as he can. The Prophets, however, don't want to see Sisko die, and try to convince him not to do so. Sisko ends up having to goad the Prophets into stopping the ships themselves for the good of Bajor, and as they hint, this act would have its price for Sisko later (eventually paid in the series finale, "What You Leave Behind").
* ''Series/{{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 BigBad himself.
** There are also several cases of ''literal'' versions, as God himself beams Sam and Dean out of Lucifer's way in the fifth season premiere, and resurrects Castiel ''twice''.
* ''Series/TwoBrokeGirls''
** Episode "And Not-so-Sweet Charity": The girls are about to lose their cupcake shop when they appeal to Caroline's heretofore unmentioned rich Aunt Charity, who writes them a check. However, this is inverted when she stops payment on the check, which she signed while on painkillers.
** Inverted by the end of that episode. Right after Caroline and Max sign the paperwork agreeing to a buyout of the lease on their months-old cupcake shop, a car crashes into the shop. Instead of saving them, this improbable event guarantees that there will be no going back, and the two will ''have'' to start working their way up from scratch again.
* At the end of 1984's ''Series/{{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, HalfHumanHybrid Elizabeth, who is only a few weeks old but has [[PlotRelevantAgeUp 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 unusually-rapid physical growth. The change to Sparkly Psychic Powers was the due to the usual ExecutiveMeddling, because we all know that ViewersAreMorons 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 Season 3 of ''Series/{{Once Upon a Time}}'', only Light Magic can defeat the big bad. However, Emma, the only character who can use it [[spoiler:loses the ability to use magic due to a curse]]. Instead, Regina inexplicably [[spoiler: becomes able to use Light Magic]]. To make matters worse, [[spoiler: it's never really brought up nor does Regina ever use Light Magic again]].

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

* 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 JerkassGods. 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.

[[folder:Radio Drama]]
* While writing the first installment of ''Radio/TheHitchhikersGuideToTheGalaxy'', Creator/DouglasAdams 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 this trope. This gave him the idea for the Infinite Improbability Drive.

[[folder:Role-Playing Games]]
* ''Roleplay/AlphaTeamMissionDeepFreezeRPG'' had a recurring Deus ex Machina where characters on the brink of death would be confronted by a mysterious voice telling them "it is time", but could be convinced to bring people back. This was basically invented by Kotua in Space as a means of getting his character, who had been reduced to a ghost forced to possess vehicles in order to stay in this world, back into a physical human body in an easy and feasible manner. This happened several times with the same people. Given the context, this might very well be a literal case of Deus ex Machina. This was later parodied by ''Roleplay/DinoAttackRPG'', in which the voice outright scolded a man for trying to convince it to bring him back. The parody is taken even farther in a non-canon post, where the voice doesn't even give another character a chance to speak for himself and sends him straight into the afterlife.
* ''Roleplay/DinoAttackRPG'' has a number of Deus ex Machina instances of its own. There are probably too many in number to list them all, but here's a few notable examples:
** When the Dino Attack Team arrived at the base of the Ogel's Island volcano, they had no means of ascending the mountainside. Quite conveniently, Reptile's T-1 Typhoon crash-landed into the volcano and dropped off some climbing gear.
** Although set up and foreshadowed several posts before it arrived, the stampeding Triceratops herd that ended the battle for the Aztec Village was {{lampshade|Hanging}}d as a Deus ex Machina. Interestingly, unlike most examples of Lampshading, this was not PlayedForLaughs but [[PlayedForDrama For Drama]], since Rex realized that relying on a Deus Ex Machina to save the day is a poor strategy that could easily backfire. Rex later attempted to {{def|iedTrope}}y Deus ex Machina by setting up a BigDamnHeroes in advance, only to be punished for it by the UnspokenPlanGuarantee.

[[folder:Tabletop Games]]
* In ''TabletopGame/DungeonsandDragons'', the high-level Cleric spell Miracle allows you to request intervention from your deity. It costs experience points to use in that fashion, but other than that the only stated downside is that the deity might refuse.
* ''[[{{TabletopGame/FateOfTheNornsRagnarok}} Fate of the Norns: Ragnarok]]'' allows player characters to ask a deity to help them in battle. A sacrifice is performed, runes are drawn, and if the aforementioned deity is in a good mood, Deus Ex Machina may occur. However, if your prayer has ''angered'' it, the divine intervention will benefit your opponents!
* In ''TabletopGame/{{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. The Gizmos advantage is designed to let players imitate fictional characters like Batman and James Bond, as described above.
* The parody RPG ''TabletopGame/HoL'' has the "Grace of God" pool, which players can put points in by rolling {{Critical Hit}}s during the game. If the character cannot get out of a situation and has points in Grace of God, they can say "Praise Jesus", which allows the DM to use any random, nonsensical, and/or inexplicable means they can think of to solve the character's dilemma.
* In the tongue-in-cheek RPG ''TabletopGame/InNomineSatanisMagnaVeritas'', 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. Also, any angel can try to summon his archangel, and any demon can try to summon his demon prince. And yes, it ''can'' work... If you're lucky.
* ''TabletopGame/MagicTheGathering'' has the "Miracle" mechanic. Cards with Miracle are all powerful, expensive spells. However, if they're the first card their owner draws in a turn, they can be immediately played for their (deeply discounted) Miracle cost, making them a sudden solution to many a hopeless scenario.
* Lampshaded in ''TabletopGame/{{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.
* ''TabletopGame/{{Shadowrun}}'' actually has a rule about this, called Hand Of God. When a PC ends up in some sort of [[NoOneCouldSurviveThat 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 ''TabletopGame/SpiritOfTheCentury'' players may use their characters' Aspects, a Declaration, or even certain Stunts to make 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)
* ''TabletopGame/WarhammerFantasyRoleplay'' and ''TabletopGame/DarkHeresy'' have the [[OneUp 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 daemon biting your head off.
* This is Modus Operandi for the Legion of the Damned chapter of Space Marines in ''TabletopGame/{{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 that creeps out the Imperials something fierce. 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 [[{{Pun}} Deus IN Machina]]. [[spoiler:[[DontExplainTheJoke You know, the Golden Throne?]]]]
* 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.
* For some {{Game Master}}s, this is going to happen eventually. Whether it be a TotalPartyKill 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 [=GMs=] will just rewrite the then-latest events, but for [=GMs=] who like to maintain the narrative, this may be the only way out.

* In the prologue to his ''Amphitryon'', the Roman playwright [[Creator/{{Plautus}} Titus Maccius Plautus]] parodied and {{lampshade|Hanging}}d 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?
* In the musical ''Theatre/CityOfAngels'', writer Stine finally snaps after witnessing the culmination of the ExecutiveMeddling on his FilmNoir screenplay, and the producer sics the studio cops on him. Detective protagonist Stone (appearing as Stine's SpiritAdvisor after his part was brutally miscast by the studio) goes over to Stine's typewriter and does a little RewritingReality, 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!"
* In Creator/JohnMilton's ''Theatre/{{Comus}}'', the Spirit complains that the brothers let Comus get away with his MagicWand so they can't free their sister -- but wait. He recounts the tale of how Sabrina (previously unmentioned) [[DeityOfHumanOrigin became a goddess]] and then calls on her to help them, which she does.
* Spoofed, perhaps even {{deconstruct|ion}}ed by Woody Allen in his one-act play ''[[http://members.fortunecity.com/bookdepository/plays/god/god2.html God]]'', an excellent if strange production which has NoFourthWall whatsoever; it's nominally about two Ancient Greeks trying to put on a play right there, when [[ThemeNaming Trichinosis]] shows [[ThemeNaming 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.
-->'''Diabetes''': God is dead.
* The Mozart opera ''Idomeneo'' includes a literal example. 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 Creator/{{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. In fact, Euripides is pretty notorious for this: he did it in ''Theatre/{{Alcestis}}'' and ''Theatre/{{Medea}}''. Creator/{{Aristotle}} called him on it in ''Literature/{{Poetics}}''. And Creator/{{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. Compare with the other Orestes, by Creator/{{Aeschylus}}, the idealist of Greek theater. In his version (the play is called ''Theatre/{{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 ''Theatre/PokemonLive'', the original Mewtwo shows up and saves the day, using his telepathy and Ash's heart to give [=MechaMew2=] a Care Bear Stare. There was no way he could defeat Giovanni on his own, especially since Pikachu had already been knocked out.
* Parodied in P.D.Q. Bach's ''The Stoned Guest''. At the end of the opera, [[KillEmAll every character is killed or otherwise dies]]. Then, for literally ''no reason at all'' ([[ExecutiveMeddling other than the arbitrary decree of the composer's patron, who didn't like the original ending]]), they all spring back to life and sing about how it's a happy ending.
* Creator/{{Moliere}} tended to lean on this to wrap up many of his comedies. In ''Theatre/{{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).
* Parodied in the [[Creator/BertoltBrecht Brecht]] play ''Theatre/TheThreepennyOpera'', 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 an 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 ''un''satisfied, and thus hopefully motivated to go out into the world and change things for the better.
* Creator/GilbertAndSullivan often used these (or very out-of-left-field [[TakeAThirdOption Third Options]] disguised as these) to resolve their plots. Which ones are straightforward Deus ex Machinas and which ones are parodies or subversions can be an interesting subject for debate.
** ''Theatre/HMSPinafore'' is certainly one of the more genuine examples; although Little Buttercup often hints that she has a dark secret, and there is a more subtle clue in [[spoiler: Ralph's erudite vocabulary]], nothing in the play could remotely help an audience think that [[spoiler: Ralph and the Captain being switched at birth]] is even plausible in the world of the play, let alone that [[ContrivedCoincidence Buttercup would have been involved]] plus on board at the right time to reveal it, etc., etc. But hey, look at that, it happens to solve both the A- and B-plots in one fell swoop! Cue the finale, it's time to go home!
** ''Theatre/ThePiratesOfPenzance'', on the other hand, is a definite parody. Not only have wacky plot elements been present from the beginning of the operetta, but there has been plenty of foreshadowing of Ruth's final revelation ([[spoiler:that the pirates are really noblemen]]); from the first line of the first song, in fact! (Examples:[[spoiler: they drink sherry instead of rum or grog, they hold fast to their code of honour even when it leads to their constant defeat in battle, and there is ''an entire song'' about how it's better to be a pirate king than a real one]]). In the same opera, the police deliberately try to invoke this. At the moment when they are most hopelessly defeated in battle, they... call on Queen Victoria: The mere mention of her name makes the pirates give up instantly out of loyalty to her.
* Creator/WilliamShakespeare was generally good at averting and subverting this. ''Theatre/MeasureForMeasure'' has an ending that probably seems like Deus Ex Machina to the characters, but the audience spent the entire play watching the Chessmaster set it up. ''Theatre/AMidsummerNightsDream'' 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 ''Theatre/TheWintersTale'' is either this or FridgeBrilliance, depending on how you read it (although it did [[ExitPursuedByABear name a trope]] that is usually a DEM). But the pastoral comedy ''Theatre/AsYouLikeIt'' is a straight example, with the father arriving out of the blue to put all conflicts to rest.
** In ''Theatre/TheComedyOfErrors'' an abbess we've never seen before shows up, and she's the long-lost wife of Egeon and mother of the Antipholuses, one of which had been living in the same town with her all this time and never knew.
** In Shakespeare's ''Theatre/{{Hamlet}}'', act IV, scene VI, [[spoiler: Hamlet is kidnapped by pirates on the way to England, who kindly return him to Denmark.]]
** In ''Theatre/TheMerchantOfVenice'', Portia produces a document at the end which reveals that [[spoiler: Antonio's ships didn't sink after all and he is still rich.]] It is never explained how she got this information or why she didn't reveal it before [[spoiler: Shylock lost everything he owned and Antonio ''nearly died.'']]

* Happens quite a bit in Franchise/{{BIONICLE}}, but three particular examples stand out:
** In the final moments of the Bohrok-Kal arc, Tahu summons the [[MaskOfPower Kanohi]] [[TimeDilation Vahi]], which gives the Toa Nuva just enough time to defeat the Kal, who were literally only seconds away from victory. There was no prior indication that Tahu had the Vahi (though the novelization ''Makuta's Revenge'' fixes this).
** In the Toa Inika's battle with Vezon, Jaller pulls out a unique Zamor Sphere that freezes Vezon in stasis, allowing the Inika to recover the Mask of Life. Unlike the Vahi example, there ''was'' a scene of Axonn giving Jaller the sphere, however its power was never explained,[[note]]The most Axonn says is that it's "for protection"[[/note]] which raises a lot of FridgeLogic.
** In the GrandFinale ''Journey's End'' arc, completely out of the blue, the Mask of Life creates a mystical set of Golden Armor for Tahu, which is capable of annihilating every single Rahkshi soldier ''and'' [[PowerCopying gaining all their abilities]]. This is said to be a contingency plan of the Great Beings, for if The Makuta ever rebelled. It was never mentioned prior to this, and you'd think it would've activated a lot sooner [[FailsafeFailure if it supposed to be a fail-safe]].

[[folder:Video Games]]
* Deconstructed in ''VideoGame/AlanWake''. [[spoiler: Thomas Zane used his reality-warping writing to bring his lover back from the dead, but by breaking the laws of narrative, he created a plot hole which the Dark Presence was all too eager to fill.]]
* Parodied in ''VideoGame/BanjoKazooie Nuts and Bolts'' with the [[DungeonMaster 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 RealityWarper levels.
* In ''[[VideoGame/BatenKaitos Baten Katios Origins]]'', during Sagi's quest, the party fights the [[GiantSpaceFleaFromNowhere Hearteater]], a PaletteSwap of the Sandfeeder. After they kill it, they find themselves completely surrounded by them and trapped. Right as they are about to die, a giant White Dragon flies by and burns them all before disappearing.
* ''VideoGame/ChoroQ HG 4'' has the resolve of [[spoiler:Otto]]'s jump start at the beginning of the climatic race in the end of the story by having [[spoiler:Barat, who has just died, [[SpiritAdvisor appears before the player and tell you to follow your ''sixth sense'']]. You then get an extraordinary speed up to beat the prince to the finish line.]]
* ''VideoGame/CliveBarkersUndying'': Played with in the [[spoiler: giant hellhound that makes it possible for you to defeat Ambrose.]] It seems like it [[AssPull comes out of nowhere,]] but read Patrick's journal and he'll mention that if you use the Gel'ziabar stone too much; you know, the one [[spoiler: Ambrose]] just stole and is using against you; a "strange dog-like beast" might show up to menace you. According to WordOfGod, the stone was once used to open a rift between our world and the hounds' dimension that never closed.
* In ''VideoGame/ConkersBadFurDay'', 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 [[NoFourthWall 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. Also subverted, because he forgot to use the Deus ex machina to [[spoiler: [[DownerEnding revive Berri]].]]
* In ''[[Franchise/CrashBandicoot 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.
* While ''VideoGame/DeusEx'', 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 DeusEstMachina.
** The protagonist of the first game was the deus 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.
* Digimon World Dawn/Dusk. The BigBad can unleash waves of chaos energy that can put humans into a coma, turn Mega-level Digimon back into eggs and even mind-control people and Digimon alike. But for some reason, you're immune to it. And in the end of the story, the BigBad merges with the Chaos Core and becomes even stronger, saying that his energy waves are now powerful enough to disintegrate data. He tries it against you, and it doesn't work for whatever reason.
* At the end of ''VideoGame/EarthBound'', the player characters are absolutely helpless until ''the player him/herself'' kills the final boss.
* 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.
* In ''VideoGame/FinalFantasyIV -Interlude-'', after [[spoiler:Rydia]] leaves the party while going up [[spoiler:the tower of Babil]] you are attacked by three robots. After taking some damage they unite into one robot which proceeds to knock you into critical status. [[spoiler:Edge]] comes out of nowhere and helps you saves you by stunning it. [[spoiler: Lampshaded by the fact its name is the Deus Ex Machina]]. Edge also helped pull a type of that earlier in the original game, where he uses a ninja technique to allow Cecil and company to go through a wall into the Tower of Babil. This never pops up again, and it isn't useable in gameplay.
* In ''VideoGame/FinalFantasyVI'', Celes regains hope if Cid dies after seeing a seagull with Locke's bandanna after her failed suicide attempt.
* In ''VideoGame/FinalFantasyVIII'', 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.
* While you fight the last final boss in ''VideoGame/FinalFantasyXIII'', [[spoiler: he turns most of your party into cieth in a cutscene. Earlier in the game, it is said that once you become a cieth, you lose your mind and all sense of self, and you will never return to normal. But out of nowhere, you get back normal and the fight continues. And then after the Final Boss, and the ending cutscene plays, it shows that all of your party has turned to crystal. Earlier in the game, it is said that you can't awake from this crystal sleep (or maybe some hundred years later)]]. But out of nowhere, you get back normal, [[spoiler: save for Vanille and Fang, but that was only because they willingly did it to save Cocoon]] and the party reunites with Serah and Dajh, who were also in Crystal stasis prior to the final boss. At the time, the scene looked like an AssPull of the highest degree. And then the sequel deconstructed this BRUTALLY. [[spoiler: Turns out what saved them was a literal example, a direct intervention by the goddess Etro... except that by doing so, she kinda ''broke time''. Naturally, this ends up causing ''far'' more harm than good, and cumulates in an outright DownerEnding.]]
* The G-Man in ''VideoGame/HalfLife2''. Also, the purple Vortigaunts at the beginning of Episode One. The ''Episodes'' like to literally YankTheDogsChain, and figuratively the player's, by plopping a DiabolusExMachina right at the finishing line of a long and arduous trial. [[Awesome/HalfLife Then DOG jumps in from nowhere to administer a concluding beat-down]].
* ''VideoGame/{{Journey}}'' does this minutes before you beat the game. You (and possibly a companion) was struggling to climb the mountain when frozen to death in the snowstorm. Six of your ancestors, the White Robes, grant you enough energy to reach the Summit. Before that, the White Robes only taught you the history of the civilization they made through images.
* ''Franchise/KingdomHearts'' has gained a reputation for KudzuPlot 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.
** There are two things especially baffling about this. First, none of the Nobodies should actually have a use for this, especially Xemnas, who levitates near-constantly. Second, whenever similar events happened in the first game, Sora would magically gain the power of flight.
** Another example is Ansem The Wise's magical anti Kingdom Hearts machine which is never foreshadowed in the slightest (though Ansem is off screen for most of the game despite claims that he intended to work with Sora. It still comes out of nowhere and solves everything).
* The ending scene of ''VideoGame/KingsQuestVAbsenceMakesTheHeartGoYonder'' has Crispin, who has been almost useless up until this point, suddenly appear and magically solve all of King Graham's remaining problems.
* One scenario in ''VideoGame/Left4Dead'' 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 [[ThePowerOfRock plan]] to call it.
** 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).
* In ''VideoGame/{{Marathon}}'', those useless [=BOBs=] who would get in your way just to get shredded by aliens save your life after you are captured. TWICE.
* Played with, but ultimately averted, in ''VideoGame/MassEffect3'' and its controversial ending:
** The [[DeusEstMachina Catalyst]], revealed in the very end to be an AI that controls the Reapers, not just the final component to fire the Crucible, suddenly lifts Shepard up to help end the cycle when the Crucible fails to fire after connecting to the Citadel. This is similar in the way the classical Greeks used the trope. The aversion comes in when he reveals that it was the Crucible that provided the solutions and he could not bring these solutions about, requiring Shepard to solve the problem by destroying or controlling the Reapers, or merging organic and synthetic life.
** Perhaps inverted if synthesis is chosen....as Shepard could be the "Deus Ex Machina" for the Catalyst, as that ending solves the Catalyst's problem as well, of finding an ideal solution to the conflicts between organic and synthetic life. This can be further explained in the Leviathan DLC when it was suggested that the Intelligence (The Catalyst) build the mass relays to control evolution to find a superior solution to his cycle. So, Shepard, viewed by the Reapers all this time as a threat, turns out suddenly to be the solution to the problem they were created for after Shepard (taking into account that he is also an organic/synthetic hybrid) connects the Crucible to the Citadel, with the Catalyst seeing Shepard as proof that organics are ready for synthesis and the Crucible the means to bring it about.
* ''VideoGame/MegaManX5'' has X being repaired. Who the hell repaired that guy so quickly after the battle? Many assume it was Dr. Light who did so, but he's dead.
** Not quite dead, as the Light Hologram is depicted to somehow possess sentience. Even if Dr. Light was crazy prepared, he couldn't possibly predict that X would need 10 different armors or to develop armor programs for a robot based on his creation (what all Reploids are) to build the armor pieces because he couldn't transmit it to him due to a computer virus he had no idea of, 200 years prior. But this is a game so just ClapYourHandsIfYouBelieve.
* ''VideoGame/MegaManX6'' had a huge ass pull when regarding the return of Zero. WordOfGod was that that X's saga would have culminated at, and completed, with X5; when [[ExecutiveMeddling CAPCOM]] decided otherwise, developers had that slight problem of Zero, despite being blown up with nothing but an upper body torso left in ''X5'', appearing healthy and alive in ''X6'' with [[UnexplainedRecovery 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.
** Not really, and lampshaded
-->'''Zero''': Do you know who saved me?
-->'''Dr. Light''': I'm sorry... I don't. Yours is a miraculous return...
* Subverted in the ''Franchise/MortalKombat'' 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 ''VideoGame/MortalKombatDeception'' - Raiden uses a previously unmentioned, non-foreshadowed release of his essence in the form of a massive explosion in an attempt to kill [[BigBad Onaga]]. He doesn't even blink.
* {{Lampshade|Hanging}}d in ''VideoGame/{{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". 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.
* For the finale of ''VideoGame/{{Okamiden}}'', you're whisked away to what seems like another dimension. The only one who came with you, other than the BigBad [[spoiler:who is possessing Kuni]] and his [[TheDragon Dragon]] [[spoiler:Kurow]], is a tiny poncle named Ishaku. No one thinks that Chibi can take on the BigBad alone, so you help Ishaku summon your partners... by ''cutting space and time''.
* Seen in ''VideoGame/PokemonMysteryDungeonExplorers of Time/Darkness'' where [[spoiler: the player character gets brought back from being ''erased from existence''.]] This is even more prevalent in the UpdatedRerelease ''Explorers of Sky'', where [[spoiler: not only do you come back, but ''everyone from the future'' is also saved.]]
* The existence and implications of Deus Ex Machinas is a huge plot point in ''VideoGame/ResonanceOfFate''.
* ''VideoGame/RivieraThePromisedLand'' has one of those right in the ending, when [[spoiler: the girl you love, having been sacrificed by Hector to bring Seth back, is revived with no further explanation by Ursula.]]
* In ''VideoGame/{{Robopon}} 2'', the day Cody is to be executed, Dr. Don and Sam show up in their time machine right inside his cell and allowing him to escape.
* ''[[VideoGame/SonicRushSeries 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 ''VideoGame/SonicTheHedgehog2006'', Sonic gets killed [[PlotlineDeath 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.
* ''VideoGame/SuperSmashBros. Brawl'' [[spoiler:The final boss of the Subspace Emissary, Tabuu has the ability to turn everyone into trophies using his Off Waves and does so to everyone when they first face him. The characters are unable to defeat Tabuu because of this when before the final boss fight with him Franchise/SonicTheHedgehog shows up randomly and attacks him, breaking one of his wings resulting in weakening his Off Wave's power, allowing everyone to be able to face him and defeat him in the final battle.]]
* Lampshaded and invoked in ''VideoGame/SuperRobotWarsMX'' during a [[http://www.youtube.com/watch?v=2Bpx66Ld-TI very brutal scene]] from End of Evangelion where Rom Stoll shows up ''just'' as the coup de'grace was about to be unleashed.
--> "That is what people refer to as...''Divine Intervention''!"
* Regal Bryant from ''VideoGame/TalesOfSymphonia''. For the entire game, he runs around wearing shackles, and fights with nothing but kicks. However, at one point late in the game, [[spoiler:everybody is caught and put into a cell. Regal then casually uses his hands and destroys the bars of the cell with a chi blast, a feat that no other character can accomplish... then tells everybody that he'll continue fighting with his feet only.]] Justified, as Regal had said he wouldn't take his shackles off until [[BigBad 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.
* ''VideoGame/TalesOfTheWorld Radiant Mythology 2'' has [[BigBad Guede]] who has the obligatory OneWingedAngel form which is ''actually'' called Deus Ex Machina.
* The only thing that stops the DownerBeginning of ''VideoGame/WarriorsOrochi 3'' ending in the extinction of humanity is Kaguya appearing out of nowhere and invoking her time travel powers.
* At the end of ''Ys V'', when the [[OminousFloatingCastle 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 EvilTowerOfOminousness of Napishtim, with no apparent way out, and it seems NoOneCouldSurviveThat. Even worse, Napishtim has summoned a Mega Tsunami in a final act of GaiasVengeance (also a DiabolusExMachina) 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 BeamSpam which nullifies the mega-tsunami and the Great Vortex, averting TheEndOfTheWorldAsWeKnowIt, and Adol is safely returned to shore.

[[folder:Visual Novels]]
* In VisualNovel/SuperDanganronpa2, the characters are forced to make a SadisticChoice: either A. [[spoiler:"Graduate", which would replace their memories of being the most dangerous terrorists alive who brought about the end of the world with the memories of the time they spent in the virtual world, reforming them and giving them hope for the future. This, however, would release a malevolent ArtificialIntelligence (specifically that of their leader during their time as terrorists) which would infect every person on the planet, essentially turning it into a world of nothing but copies of said leader, plunging the recovering world into a permanent state of blood, horror, and, most especially, despair. Oh, and it would also trap a couple surviving characters from the first game inside the virtual world.]] Or B., [[spoiler:activate the "Forced Shutdown", resulting in them losing all of the memories they've acquired in the virtual world and revert back to being the horrible terrorists (who are also physically mutilated), with a chance of being executed. However, this would completely destroy said malevolent AI, saving the world.]] They choose option B. The ending of the game reveals that [[spoiler:after getting out of the program, the characters decide to stay on the island and try to revive their friends who died inside the virtual world (of which there is a very, very small chance of pulling off), peaceably seeing off said first-game characters who put them in the program in the first place.]] Obviously, [[spoiler:they didn't simply revert to their old terrorist selves; either the Forced Shutdown replaced their terrorist memories with their virtual ones, or they now have both sets of memories.]] Either way, [[spoiler:there was no foreshadowing or explanation given for how or why the program would behave in such a way.]]

[[folder:Web Comics]]
* ''Webcomic/TheAdventuresOfDrMcNinja'' hangs a lampshade on this [[http://www.drmcninja.com/page.php?pageNum=9&issue=3 here]].
* ''Webcomic/BobAndGeorge'', 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).
* [[Webcomic/DinosaurComics T-Rex]] explains it in his inimitable style [[http://qwantz.com/archive/001354.html here]].
* In an apparently unintentional {{lampshade|Hanging}}d example, Miranda of ''Webcomic/DominicDeegan'' has taken to calling herself "Deus Ex Momina," being a rather jarring ParentExMachina in what is neither a sitcom nor starred by a teenager. WordOfGod states the joke was her terrible delivery of the joke rather than being one of the most MetaGuy moments the comic's ever had. There are other events where this happens, sometimes even being mentioned by the cast. "[[http://www.dominic-deegan.com/view.php?date=2004-03-01]]"
* The plot of ''Webcomic/ErrantStory'' 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 [[LampshadeHanging 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.
* In ''GameDestroyers'', Ferahgo is a purposeful example of this, and Jipples has become a minor, though lazy, example of this as well.
* Actually named in ''Webcomic/GoneWithTheBlastwave''.
* ''Webcomic/KevinAndKell'' has seen its fair share of these in its [[WebcomicsLongRunners two decades as a comic]]. One arc [[http://kevinandkell.com/2011/kk0608.html from June of 2011]] involving factional elections amongst rabbits comes to an end with a completely unexplained, contrived resolution that [[StatusQuoIsGod restores the status quo]], just in time for [[InvincibleHero 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. Even if [[http://kevinandkell.com/2011/kk0623.html the final strip]] is a hint to who saved the day, it's still never mentioned before or after.
* ''Webcomic/TheOrderOfTheStick'': The [=MitD=] plays this role in [[http://www.giantitp.com/comics/oots0661.html 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. [[http://www.giantitp.com/comics/oots0441.html This comic]] also features something that is hard to accept at face value (no air turbulence and coincidence). It's deliberately played off under RuleOfFunny so it is excusable, but still tastes like a WriterCopOut. Receives {{lampshad|eHanging}}ing [[http://www.giantitp.com/comics/oots0504.html here]]. Also, while it's not quite an example (there are a few hints), the comic lampshades how close it is to this when [[spoiler:Julio Scoundrel arrives just in time to save the Order of the Stick from Elan's father in his flying airship. The name of his airship? ''The Machina''.]]
* LampshadeHanging: In ''Webcomic/QuestionableContent'' the cast are trapped in an alley by a crazed KnightTemplar / AntiHero and her robot {{Sidekick}} until they are saved at the last minute by their own [[RobotBuddy 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 MundaneFantastic and a [[SpeculativeFiction sci-fi]] or {{superhero}} world.
* Justified: ''Webcomic/SluggyFreelance'' features a literal Dea Ex Machina who is not a literary Deus Ex Machina in the "[[http://www.sluggy.com/daily.php?date=040519 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 SealedGoodInACan (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 provides a DoubleSubversion. 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 ResetButton if broken, and that Bun-Bun's main antagonist SantaClaus has one of them. Finally, when Santa is left with no other options, he tries to use it, but [[spoiler: Bun-Bun, being the Easter Bunny, has hidden the egg]]. Later, [[spoiler: Bun-Bun himself is forced to use it to save his own life, magically bringing all of his enemies back to life and defeating him, but leaving him alive.]]
** 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 [[RiddleMeThis 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.
* ''Webcomic/SchlockMercenary'' on several occasions. Also lampshaded [[http://www.schlockmercenary.com/d/20050319.html here]].
** The Petey-focused extra story in the printed version of book 7 is actually called "Deus ex Nausea", as scenario after scenario is resolved by sudden Fleetmind interference. He's actually trying to subtly kill the literary device in several cultures in an attempt to make them more self-reliant, which gets awkward when he's simultaneously acting as one.
* In ''Webcomic/{{Sinfest}}'', [[http://www.sinfest.net/view.php?date=2010-05-20 Lil' Evil complains to God that an event is one.]]
* [[http://www.somethingpositive.net/sp02132009.shtml The resolution]] of the sexual harassment subplot in ''Webcomic/SomethingPositive''.
* Parodied in ''Tom the Dancing Bug'' [[http://lost.co.nz/library/godman/strips/25-Billy_Dare_Smugglers_Cape_chapter_MVLXX.html here]].

[[folder:Web Original]]
* [[http://www.wowwiki.com/Chronicle_of_the_Annoying_Quest 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 [[HilarityEnsues hilarity to ensue...]])
* The 7th ''Literature/ChronoHustle'' story, which is in fact title Deus Ex Machina, involves a situation where Jack Masterson is about to be raped by Aphrodite. He has no way out of the situation when suddenly [[spoiler:Hermes]], who had not been so much as mentioned up to that point, shows up. He [[spoiler:doesn't actually save the day, but does provide enough of a distraction to give the rest of the main cast time to show up.]]
* In ''Roleplay/TheGamersAlliance'', 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 [[AntiVillain Kagetsu I]] whom Leon had unknowingly freed earlier. [[{{Pun}} Technically Kagetsu was only a half-god, though]].
* When [[Literature/TheLayOfPaulTwister Paul Twister]] is right about to get caught by a guard, an angelic warrior whose life he had saved at the beginning of the story shows up to conveniently provide a distraction, just long enough for him to get away. [[GenreSavvy Paul is a bit freaked out by this, since it seems to have come out of nowhere]] and required knowledge that she shouldn't have had, and he figures that [[ThisIsGonnaSuck whatever he's caught up in is probably about to get worse.]]
--> Things like that just didn't happen to me, suddenly being bailed out by an unexpected ally, just seconds after being caught flat-footed. And she was a Celestial, to boot. [[LampshadeHanging Seriously, all that was missing was the ''machina''!]]
* Averted during the course of [[WebVideo/TheNostalgiaChick The Dark Nella Saga]] with the jar of mayonnaise. While it does allow for teleportation [[spoiler:and resurrection]] it was shown being injected with "a plot device" by Lord MacGuffin early on in the saga. The only remaining question is how [[MadScientist Dr.]] [[HotScientist Tease]] got the jar in the first place...
* {{Lampshade|Hanging}}d in [[http://onering.legendaryfrog.com/movies_or2_w.php 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".
* PlayedForLaughs in Website/TheOnion 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 on the losing end of a CurbStompBattle.
* Critics of the ending to ''Roleplay/SurvivalOfTheFittest'' 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 [[TrueCompanions his dead friends]] may have been [[ThePowerOfFriendship protecting him]].

[[folder:Western Animation]]
* ''WesternAnimation/TheAdventuresOfSuperMarioBros3'' did this often with the magic wands with "The Beauty of Kootie," and "7 Continents for 7 Koopalings," serving as the most blatant examples.
** [[AvertedTrope Averted]] in "Recycled Koopa" in which magic didn't really solve anything.
* ''WesternAnimation/AladdinTheSeries'' [[LampshadeHanging hung an enormous lantern]] in the form of a ParentalBonus: One episode involved the hunt for the "Orb of Machina", a MacGuffin intended to cure Genie's cold.
* ''WesternAnimation/AmericanDad'':
** Parodied when just as 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 ''Film/ItsAWonderfulLife''. However, none of it mattered in the end, as it was AllJustADream.
** Though a real one 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.
* A few episodes of ''WesternAnimation/TheAngryBeavers'' 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 [[Film/FreeWilly 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.
-->'''Norbert''': Where in the name of Deus Ex Machina did that T-REX come from?!
** [[spoiler: As it turns out, [[WhatAnIdiot Dagget happened to bring home the T-rex from an amusement park prior to the Killer Whale,]] [[HereWeGoAgain and are promptly chased by a new more vicious predator]].]]
* Every season finale of ''WesternAnimation/AvatarTheLastAirbender'' and its sequel, ''WesternAnimation/TheLegendOfKorra'' (so far) has ended with at least two of these[[note]]With the exception of ATLA Book 2, where there had a DiabolusExMachina and TLOK Book 3, which was a convenient contrivance at worst[[/note]]:
** '''ATLA Book 1''': Yue [[HeroicSacrifice sacrifices herself]] to restore the Moon Spirit and restore Waterbending. Aang merges with the Ocean Spirit to become [[FanNickname "Koizilla"]] and destroys the Fire Nation fleet.
** '''ATLA Book 3''': Thanks to the events of the Book 2 finale, Aang is unable to access the [[SuperMode Avatar State]] and in the showdown with [[BigBad Fire Lord Ozai]], Ozai has him on the ropes. Ozai presses his attack against Aang's desperation rock shield and conveniently smashes Aang into a rock that hits him in the ''exact right spot'' to unblock his chakra and activate the Avatar State, flipping the fight into a CurbStompBattle in Aang's favor. This is only after Aang has gotten a completely unknown form of bending handed to him by a Lion Turtle. While the Lion Turtles have been mentioned previously, energybending hasn't.
** '''TLOK Book 1''': Amon manages to take away Korra's Earth, Fire and Waterbending, but unlocks her previously unaccessible Airbending in the process, allowing her to beat him and -expose him as a Bender to Republic City. With Katara unable to heal Amon's damage, she's the Avatar in name only. When Korra travels and sits by an ice cliff to reflect and cry over her loss of identity, she's finally able to communicate with the spirit of Aang (something she's been unable to do the entire season). One flash of Aang's Energybending later, and not only does Korra have all her other bending back, now she's able to access the [[SuperMode Avatar State]] (which she's also been unable to do). She's then able to restore the bending of every one of Amon's victims.
** '''TLOK Book 2''': Deus-ex-Jinora. Vaatu fuses with Unalaq and reduces Raava (the Avatar Spirit) down to her bare essence. Korra uses the Tree of Time to pull some super spirit mojo and goes after [[FanNickname Unavaatu.]] So far so good. But it turns out she's not up to the task, and just as Unavaatu begins to use Unalaq's spirit-waterbending technique to corrupt her, Jinora's spirit suddenly appears from the spirit aurora over Republic City with an orb of light and showers it on cosmic Korra and Unavaatu, which has the resulting effect of dispelling Unavaatu's spirit-waterbending corruption technique and then jumpstarting/revealing Raava's regrowth inside Vaatu, thus allowing Korra to free Raava and purify Unavaatu.
** '''TLOK Book 3''': The mildest of the bunch. Korra is down for the count, poisoned by Zaheer and the Red Lotus. But Jinora tells Suyin Bei Fong that the poison is metallic, so she can still save Korra (Yes, she saw them administer the poison in her spirit form, but how did she know it was metallic?). Suyin manages to metalbend the poison out of Korra's body (somehow), saving her life - though she's still wheelchair-bound, two weeks later.
* The finale of ''WesternAnimation/BeastWars'': 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. They take that shuttle, kamikaze it into the enemy ship, and then fly home on it, creating a StableTimeLoop.
--> '''Blackarachnia''': ''The history tracks never mentioned this!''
--> '''Rhinox''': ''History's still being made!''
* ''WesternAnimation/CampLazlo'': 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.
* In a HalloweenEpisode of ''WesternAnimation/TheClevelandShow'', Cleveland defeats a JerkJock from a neighboring town by setting a polluted river on fire, which wakes up a sea serpent that eats the guy whole. Cleveland himself didn't know it was there.
** In another episode, Cleveland and the kids are about to go over an InevitableWaterfall with seemingly no hope of surviving it when a grey screen with "Scene Missing" comes up. When it cuts back to the episode, Cleveland is thanking a talking Walrus with a handlebar moustache and top hat for saving them, then the Walrus jumps into the water, claps, then jumps out and flies off leaving behind a trail of rainbows.
* Many of WesternAnimation/{{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.
* Several ''WesternAnimation/EarthwormJim'' episodes ended with very blatant examples, all operating under RuleOfFunny. An example is when Evil the cat unleashed a cosmic MonsterClown that was unstoppable. Jim calls an ObstructiveBureaucrat, who demands the clown 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 where the bad guy is beaten, somehow gets back into power in the last few seconds, then gets hit by the [[RunningGag falling cow.]]
* ''WesternAnimation/TheFairlyOddParents'' MusicalEpisode: the loophole in Flappy Bob's contract that defeated the pixies isn't even hinted at until the final act.
* ''WesternAnimation/FamilyGuy'':
** The ending of the episode "Lois Kills Stewie". No, before we find it out it was a [[AllJustADream 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.
** Another Family Guy episode involved Stewie adopting a malevolent turtle. Long story short, things escalate and they end up in a fight to the death. Stewie, for whatever reason, is no match for the small reptile, and is nearly killed... until [[SuperMarioBros Super Mario]] bursts in and kills the turtle.
** There was also that one time "Democracy took hold" and ended the Iraq War.
* The [[WesternAnimation/FantasticFour 90s Fantastic Four show]] has "Where Calls Galactus", where {{Galactus}} decides to consume Earth after [[EnemyMine allying with the Four against a common enemy]]. All seems lost...[[spoiler: until Comicbook/GhostRider shows up out of ''nowhere'', uses his guilt-inducing power to incapacitate Galactus, and then vanishes into the night.]] It should be noted that the episode is based on a comic book arc by Creator/JohnByrne, and it makes much more sense in the original.
* ''WesternAnimation/TheFlintstones''' CowboyEpisode was resolved when a stone version of the [[Series/{{Bonanza}} Cartwright family]], with no warning whatsoever, charge in out of nowhere to rescue the main characters.
* ''{{WesternAnimation/Futurama}}'' has an in-universe example with Fry creating his own deus ex machina while trying to save the Earth from a Brainspawn invasion. After cornering the Brainspawn leader in a library, it forces Fry, Leela and itself into the nearby books (causing the three to relive events from whatever book they're in,) with the chase scene eventually ending with Fry trapping the Brainspawn leader in a poorly-written book that he wrote on the spot, which ends with the leader killing Fry in the book and then suddenly leaving [[RougeAnglesOfSatin "for no raisin."]]
* During an episodes in ''Harry and His Bucket Full of Dinosaurs'', Harry is playing a life sized version of snakes and ladders, with the snakes leading you to a tub of "bubbly wubbly" (comfortable green bubbles), required a roll of 2 in order to escape. Just before they're about to win, they land on a snake. Harry somehow leaves the die behind on the board, and therefore has trapped himself and all his dinosaurs. Everyone is worrying about how they're stuck indefinitely and are thinking of a way to escape when Trike, the Triceratops, creates a large racket scratching himself with a playing card that he found out of nowhere (and offscreen too). Harry takes the card, and it very conveniently is a "GET OUT OF THE BUBBLY WUBBLY TUB AND GO TO THE LAST SQUARE" card.
* Played straight in the {{cliffhanger}} episode “Council of Evil” in ''WesternAnimation/HeManAndTheMastersOfTheUniverse2002''. Skeletor’s Council of Evil has taken nearly all of the Masters hostage; he’s used the Ram-Stone to force open the doors of Greyskull, knocking the Sorceress out in the process. The only thing standing in his way is Adam, who doesn’t even have his Sword of Power (having dropped it earlier). Nonetheless, Adam is determined to fight to the end… Until, as a final sign that the universe hates him, Skeletor’s old henchmen show up, having been sprung from prison by Kobra Khan. The villain simply knocks him into the abyss surrounding Greyskull saying “Good riddance to bad royalty!” and it seems the DarkestHour is truly upon Eternia. Would a miracle occur? Try ''three'' miracles. First off, Orco shows up where Adam lands, having recovered the Sword. Then, from seemingly nowhere, Zodac appears inside the Castle and revives the Sorceress, and they combine their powers to reinforce the barrier. Skeletor attempts to use the Ram-Stone again, only for Adam – now in his heroic form as He-Man – to take him by surprise, grab it, and crush it. He’s still outnumbered, but then comes number three – cue a BigDamnHeroes by the other Masters, who have been rescued by Moss Man (who Skeletor had never even considered, it seems). After this, the villains decide to [[ScrewThisImOuttaHere cut their losses and flee]], but it did seem like everything all came out of nowhere. And the stage is set for Season Two.
* In the ''WesternAnimation/HouseOfMouse'' HalloweenEpisode ''Mickey's House of Villains'', various Disney Villains [[HostileShowTakeover take over the clubhouse at midnight on Halloween]] in a bid spearheaded by Jafar, turning it into the [[TitleDrop House of Villains]]. After all other attempts to get the clubhouse back fail, Mickey resorts to wearing his robe and Yensid's hat from the ''Disney/{{Fantasia}}'' short so he can engage Jafar in a magic duel. Jafar kicks his ass anyway, and things look quite grim... until Aladdin just shows up and tosses the heroes the magic lamp. Plausible, yes, but clearly not set up in prior scenes. Aladdin wasn't even seen at the house prior to this moment, so it's possible he wasn't even there until the final act and couldn't have had any way of knowing the heroes needed him to give them the lamp. It wasn't even Jafar's lamp. It was Genie's.
* ''WesternAnimation/MegasXLR'' got most of its humor from the fact that the titular HumongousMecha was a literal example. 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 this of the episode backfired or misfired and the thing that ends saving the day turns out to be [[BrickJoke a seemingly unimportant plot element from earlier in the episode]].
* In ''WesternAnimation/MyLittlePonyFriendshipIsMagic'':
** ''[[Recap/MyLittlePonyFriendshipIsMagicS1E21OverABarrel Over A Barrel]]'': There's a conflict between the natives of the land and the newly settlers over the land; during the episode they keep arise the issue of reaching a consensus of relocating the apple orchard so the Buffaloes may complete their time-old tradition, or for Buffaloes to just go around the orchard. But somehow, everything is solved after a "[[FoodFight gruesome]]" battle; by the Buffaloes' appreciation for the settlers' pastries. So now the settlers agreed to a path through the trees (rather than cut down all of them as the Buffaloes originally wanted), and even agreed to share the wealth of the land with the Buffaloes.
** ''[[Recap/MyLittlePonyFriendshipIsMagicS2E3LessonZero Lesson Zero]]'' also includes a Deus Ex Machina, in the form of [[TheCavalry Celestia]] showing up and dispelling the Want It, Need It spell from Mr. Smartypants and telling Twilight that no, really, you don't actually have to send a letter every single week (though in the end Celestia manages to turn it into everyone sending her letters sporadically). Justified in-story after the fact as Spike having surreptitiously contacted her off-screen when Twilight was spiralling out of control. Less unacceptable than most examples as the central conflict of the story was Twilight freaking out over nothing rather than the Want It, Need It spell and Celestia talking to Twilight was a logical means of solving the true central conflict.
** Subverted and played with in ''[[Recap/MyLittlePonyFriendshipIsMagicS2E1TheReturnOfHarmonyPart1 Return of Harmony Part 1]]'' when strange things are happening such as chocolate raining down from clouds made of cotton candy and ears of corn spontaneously popping into popcorn. Twilight Sparkle shows up out of nowhere claiming some new spell she had conveniently just learned [[EpicFail should fix everything]].
--->'''Twilight:''' My fail safe spell... FAILED!
** ''[[Recap/MyLittlePonyFriendshipIsMagicS4E26TwilightsKingdomPart2 Twilight’s Kingdom Part 2]]'': Tirek steals all magic in Equestria and appears unstoppable... then the Mane 6 open that hexagonal box and everything’s fine.
** ''[[WesternAnimation/MyLittlePonyEquestriaGirls Equestria Girls]]'': Blatantly. Both the viewer and all the characters fully expected that Sunset Shimmer would ''kill'' Twilight Sparkle, but then “the magic of friendship” intervenes.
* Spoofed in the ChristmasSpecial ''WesternAnimation/OliveTheOtherReindeer'': 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"
-->'''Olive:''' D'you know anyone named Deus ex Machina?
-->'''Martini:''' Denise who?
* ''WesternAnimation/PhineasAndFerb'' relies on several per episode as {{running gag}}s to maintain the status quo. It is usually excused with RuleOfFunny.
** Perry and Doof in "[[Recap/PhineasAndFerbPhineasAndFerbGetBusted Phineas and Ferb Get Busted]]".
* Invoked in ''WesternAnimation/ReBoot''. 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 CerebusSyndrome, an episode about Hexadecimal changing all of Mainframe [[TakenForGranite to stone]] concluded with Hex deciding she was bored and snapping her fingers to de-petrify everyone. Admittedly, it took a little [[TalkingTheMonsterToDeath prompting]] from Bob. And it is [[MadGod Hexadecimal]]...
* ''WesternAnimation/TheSimpsons''
** Parodied and lampshaded in the episode "Thank God, It's Doomsday" 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 ([[InsaneTrollLogic on the logic that Superman did it in his first movie]]), God raises His hands skyward and shouts "''Deus Ex Machina!''", after which everything goes back to normal.
** "[[Recap/TheSimpsonsS11E15MissionaryImpossible Missionary Impossible]]" 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 [[NoEnding left unresolved]].)
** The ''Literature/LordOfTheFlies'' parody episode "[[Recap/TheSimpsonsS9E14DasBus Das Bus]]" where all the kids are left stuck on the island at the end and Creator/JamesEarlJones, in a voiceover narration role, says that they were eventually saved by "...oh, let's say, Moe".
** That infamous episode "[[Recap/TheSimpsonsS7E18TheDayTheViolenceDied The Day The Violence Died]]" 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 [[IdenticalStranger Lester & Eliza]]. They also helped Apu after he was arrested for public nudity and helped Krusty get back together with his never-before mentioned estranged wife.
* ''WesternAnimation/SouthPark'': Mintberry Crunch of the Superhero arc, but a lesser example as it was hinted someone would step up.
* The end of the WesternAnimation/{{SpongeBob|Squarepants}} episode ''Hello, Bikini Bottom''. Mr. Krabs buys back the Krusty Krab with Gary's collage funds after selling it to a pawn shop in the beginning so he can afford to take SpongeBob and Squidward on tour.
* ''WesternAnimation/TeenTitans'' loved doing this.
** In [[Recap/TeenTitansS3E13TitansEastPartTwo the Season 3 Finale]] Cyborg is the only Titan left who can resist Brother Blood's [[MindManipulation 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 [[HeroicResolve "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.
--->'''Beast Boy''': [[DoingInTheScientist So are you magic now or something?]]
--->'''Cyborg''': [[ItOnlyWorksOnce I'm sure it was a one-time deal.]]
*** And they explain the mechanic fine (Blood was trying so hard to use his PsychicPowers 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.
** In [[Recap/TeenTitansS4E13TheEndPartThree the Season 4 Finale]] Raven embraces ThePowerOfFriendship, reverts to her normal age, and gains complete control of her powers long enough to blast her evil father into oblivion.
* In ''WesternAnimation/TinyToonAdventuresHowISpentMyVacation'', 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).
--> '''Buster:''' [[SelfDeprecation I was wondering how our hack writers would get us out of this one.]]
* At the end of the ''WesternAnimation/TheTransformers'' 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 ''Anime/TransformersSuperGodMasterforce'', The Autobots are revealed to be equipped with non-lethal knockout gas just as Decepticon zombies attack Rome.
* ''WesternAnimation/TransformersPrime'' has an episode titled [[InvokedTrope 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 [[LampshadeHanging explains how the trope works]] just before Fowler shows up to execute it (although he ''was'' mentioned earlier, so it's not 100% straight).
* ''WesternAnimation/WinxClub'':
** In the tenth episode of season 2, Bloom discovers her healing powers when she brings Sky back from the dead.
** In the Season 1 finale, Bloom manifests the ability to teleport the way witches do (without a portal, for which a special form is required in Season 4) just in time to save herself from drowning and **** Icy off enough to waste a ton of magical power trying to shoot her down again, which basically wears her out so much that she passes out; considering that Bloom was useless with magic for most of the first season (and, in fact, had no powers for much of the back half of the season), it's nothing less than miraculous.
* ''WesternAnimation/YogiBear and the Magical Flight of the Spruce Goose'' ends with the titular plane magically flying itself back home while everyone is sleeping.

[[folder:Real Life]]
* This happened ''twice'' to Friedrich the Great, King of Prussia. In the same war. Both were called the Miracle of the House of Brandenburg. The first consisted of his foes suddenly turning back from assaulting his capital after he had been dealt an uncharacteristically crushing defeat (they were low on supplies and they feared they wouldn't be able to hold Berlin), the second, and more widely known one, involved the Tsarina, formerly his most implacable enemy, suddenly dying, giving way to the Prussophile Peter, who immediately made peace. Two centuries later, this led to [[UsefulNotes/AdolfHitler a very different German leader]] to hold out hope for a similarly unexpected stroke of luck at the end of his own war, but the gods wisely didn't smile on that bastard.
* 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".)
** And happened ''again'' in the far more obscure Spanish invasion of [[http://en.wikipedia.org/wiki/Battle_of_Glen_Shiel#Alberoni_plan 1719]].
** Inverted (in that France is considered Catholic): [[http://www.cracked.com/article_18894_6-real-historic-battles-decided-by-divine-intervention_p2.html?wa_user1=5&wa_user2=History&wa_user3=article&wa_user4=recommended 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.
* 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.
** The Japanese Emperor competence and Mongol incompetence deserve a lot of credit for this for more mundane reasons than conveniently-timed Divine Intervention. After the Mongol's first invasion, the Emperor ordered walls built along the beaches in all suitable landing places so locals could hold off invaders long enough for samurai defenders to be deployed. The Mongols did not understand the difference between seaworthy ships and riverboats and commandeered many riverboats for their sea invasion rather than pay the expense of building a proper invasion fleet. When the Mongols arrived, they sailed around for months in mostly non-seagoing ships looking for a landing place. Sooner or later, bad weather would have sunk most of the fleet. River boats don't do well in the open ocean. The Emperor used the storms that sank the Mongols to promote the idea that Divine Mandate said that he and he alone should rule Japan.
* [[http://www.cracked.com/article_18894_6-real-historic-battles-decided-by-divine-intervention.html Deus Ex Machina]] basically gave America the win for quite a few battles in some pretty important wars. America's intervention with a million man army in World War One, after 3 and half years of German victories counts as a Deus ex Machina from a European perspective.
* The infamous [[http://en.wikipedia.org/wiki/Snowplow_Game "Snowplow Game"]] is an example for the New England Patriots (as for the Miami Dolphins, it's DiabolusExMachina).