->''"Where in the name of deus ex machina did that [[EverythingsBetterWithDinosaurs T-Rex]] come from?"''
-->-- '''Norbert''', ''TheAngryBeavers''

->'''Shion Sonozaki:'''"...I'm going to kill you. Once I finish killing Satoko that is."\\
'''Satoko Houjo:'''"Boy, what I wouldn't give for some kind of DeusExMachina conclusion right about now"\\
'''Satoshi Houjo:'''"Did someone say DeusExMachina?"\\
'''Shion Sonozaki:'''*surprised*\\
'''Keiichi Maebara:'''"Oh my God, it's Satoshi Urushihara"
-->-- "[[http://higurashiparodyfandub.blogspot.com/2009/03/halloween-special.html Higurashi Parody Fandub]]

A common form of {{Asspull}} or WriterCopOut, a DeusExMachina is an outside force that solves a seemingly unsolvable problem in an extremely unlikely (and, usually, [[AntiClimax anticlimactic]]) way. If the secret documents are in Russian, one of the spies suddenly reveals that [[IKnowKungFu they learned the language]]. If the writers have just lost funding, a millionaire suddenly arrives, announces an interest in their movie, and offers all the finances they need to make it. If TheHero is [[CliffHanger dangling at the edge of a cliff with a villain stepping on his fingers]], [[BoringInvincibleHero a flying robot suddenly appears to save him]].

The term is Latin for ''god out of the machine,'' and has its origins in [[OlderThanDirt Greek theater]]. It refers to situations in which a crane (''machine'') was used to lower actors or statues playing a god or gods (''deus'') onto the stage to set things right. It has since come to be used as a general term for any event in which a seemingly fatal plot twist is resolved by an event never foreshadowed or set up.

There are four primary forms a DeusExMachina can take:

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

The lines between DeusExMachina and other [[IncrediblyLamePun devices]] are thin and blurry. If the same villain was suddenly brained by sniper's shot without any plot connections it would likely be type 2: BigBad is likely to have foes, but here's ContrivedCoincidence. If this sniper turns out to be some long-forgotten Victim Of The Week or a relative, it's type 3. If one of hero's potential allies did refuse to participate in the action, but decided to act on his own and it's in character, it may be type 4. If the villain was earlier attacked by some enemies, lurked in his lair with tight security, but then went out of his way to punish hero and made a good target of himself by posturing and gloating in the open, it's not even ChekhovsGun, just a [[TheCoronerDothProtestTooMuch death by carelessness]].

Note that the Romans and Greeks used type 1 and 2. However, it was largely ironic, since most plays were put on and funded by royalty and it wasn't a good idea to lay a DownerEnding on your boss. So playwrights would basically imply the tragic ending they intended, and then pull them out at the last minute. Audiences mostly got it. However, today's writers are not afforded the luxury of such excuses and audiences now find it rather contrived. However, there are some [[ExecutiveMeddling modern instances where]] [[DisneyDeath this application of the trope survives]].

Deus Ex Machina appear ''astoundingly'' often in all forms of fan-fiction -- either because the author has written himself into a corner and needs a solution -- ''any'' solution -- to conclude the story, or because the author is just plain lazy and it's the easiest way out.

(Needless to say, most forms of MarySue are Deus Ex Machina of the above parameters).

Much abused as a term for [[AGodAmI making ourselves gods]] by the application of technology, e.g. cyborgs; this isn't what it means at all!

The ResetButton often depends on DeusExMachina. See also {{Asspull}} and DiabolusExMachina. Particular types of deus ex machina include CoincidentalBroadcast, YouDidntAsk, and often, EurekaMoment. Sometimes lead to a GainaxEnding.

Also, for those who have no idea how to say it: ''day''-oos ex ''mack''-in-uh.
----
!!Examples:

[[foldercontrol]]

[[folder:Anime and Manga]]
* Played absolutely straight in ''[[TheSlayers Slayers NEXT]]''. Nearly the entire plot revolves around Lina's refusal to cast the Giga Slave after her discovery that miscasting it will 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 obliterate their souls as well). However, Gourry's forced to bargain away the Sword of Light in return for bringing back Lina. Given she does everything else for free, one has to wonder if that wasn't just an effect of the goddess's borrowing Lina's form.
* The final episode of the ''AngelSanctuary'' OVA is about as literal an example of this trope as it gets.
* [[{{Pokemon}} Pokémon]] loves and thrives on this, and many seemingly unwinnable situations are weaseled their way out of by Dei Ex Machinis.
** The second involves a situation involving a showdown between Team Rocket and "the twerps" where either Team Rocket seems to have the upper hand or the two sides have been forced into a dangerous stalemate. Cue a single, recurring Pokemon, typically either Marker-Jigglypuff or Misty's Togepi. The former will sing their soothing music and cause everyone to fall asleep (thus enraging it and causing it to doodle vengefully on everyone), or the latter will start using the metronome attack, which causes a burst of random Deus Ex Machina energy to fill the room and set everything right.
** May's Skitty has the Assist technique, which randomly uses an attack known by another member of the party. Of course, it naturally has the RandomNumberGod on its side.
** The most ridiculous example is at the end of the ninth movie. Everyone had evacuated the flooding Sea Temple as Ash was trying desperately to fix the Sea Crown that the BigBad had tried to steal. The temple rises to the surface of the water, but Ash doesn't come out. Everyone thinks he drowned and starts crying, and Phantom takes advantage of the moment to grab Manaphy and make his getaway. It would've worked, except at that moment, Ash bursts out of the water, ''surrounded by glowing golden light'', and ''flies'' through the air to save Manaphy.
** In the Pokemon Special manga, Ruby can't penetrate through the lightning that a machine made to be able to defeat the Big Bads. What does he do? The only logical thing, of course, call out [[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 his [[spoiler:time powers to revive Norman, Steven, and the Team Magma girl. And Celebi's not even caught in a GS Ball, which the Mask of Ice needed a full blown out plan to get!]]
*** Well, he's shown in at least one scene to be using a mysterious power which comes off as pretty random, but not DeusExMachina levels. Also, [[spoiler:legendaries seem to be superpowered compared to regular Pokes]], even considering that Swampert wouldn't be hurt by electricity in the first place.
* Batou is saved from certain death in GhostInTheShellStandAloneComplex by an extraordinary literal example.
* The heroes in ''{{Yu-Gi-Oh}}'' seem to win solely on pulling the one card out of a forty card plus deck that can save them from doom. Many times, these cards are not alluded to prior to their save the world moment and turn the tide of the battle completely 180 degrees. After all, how many times have you heard the line "It all comes down to this one card" only to have them draw a complete waste of a card?
--> '''[[{{YuGiOhTheAbridgedSeries}} Yami Yugi]]''': I activate "Deus Ex Machina"!
--> '''[[{{YuGiOhTheAbridgedSeries}} Weevil]]''': ([[BeavisAndButthead Beavis-esque voice]]) Hee hee! Hey! No fair! You can't use spell cards on my turn!
--> '''[[{{YuGiOhTheAbridgedSeries}} Yami Yugi]]''': Tell that to the writing staff!!
** 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 the PowerOfFriendship scene just before, that draw would have been ridiculous even by Yu-Gi-Oh standards.
** In the manga version of the story, this is actually ''Yami Yugi's superpower''. Which of course says nothing about the fact that other characters pull the same stunt.
** To be completely fair, there's no way to know what card ''any'' character is going to draw, so situations are as much set up by Deus Ex Machina as they are resolved by them.
** In the last duel of the Battle City Final Yugi plays Raganrok, 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.
*** And that "Deus" happens to have its own trope: RandomNumberGod.
** Don't forget how 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.
** [[spoiler: During Atem's duel with Yugi, he's able to use the power of the Millennium Puzzle to alter fate in order to pull the exact card that he needs.]]
* ''{{Sonic}} X'' has one of these in the finale of its final season, where the stone Cosmo has been wearing since the beginning of the series is revealed to be a magical amulet that can automatically accellerate her growth so that she reaches the stage of becoming a tree (as is apparently the fate of all her species) early, attaches herself to the bad guy and weaken him so that the Good Guys can shoot and destroy. We had heard pretty much nothing about this earlier in the series.
** Said stone MAY only be magical by default, depending on whether you believe the dubbing. Previously ALL seedrians were seen to be wearing a similar stone, so it might just be a general species thing. Either way it was still kind of an Asspull.
* Occurs in all three installments of the ''{{Transformers}}'' Unicron Trilogy trilogy; at some point the Autobots are defeated and critically damaged, but then they are repaired and upgraded(and in the third installment given new vehicle modes), by the Minicons in ''[[TransformersArmada Armada]]'', then by Primus in ''[[TransformersEnergon Energon]]'' and ''[[TransformersCybertron Cybertron]]''.
** In an earlier series, this is what saved Star Saber from Deathsaurus in ''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 ''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.
* ''EurekaSeven'' grants us the wonderful moment where the protagonist ''magically creates'' a [[NewPowersAsThePlotDemands new, super-powerful unit]] out of thin air by the [[foldercontrol]]

[[folder: Power Of Love ]]
!
** Note: this is very likely true. Also note that it's not nearly as bad as it sounds because this series takes ThePowerOfLove and runs with it.
* In ''{{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.
** Not to mention he pulled this all off in the time it took for a 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]].
* ''{{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 some how ''loses the will to live'' and [[KillEmAll just dies]].
** Her repeated refining left her body a complete wreck, and her only reason for living/fighting was so that her sick brother could get treatment.
** This still doesn't justify her death, as she was still in perfect shape to keep fighting Kazuma, then just *dies* when he kicks.
** Although it's not quite justified (Since her brother died while they were fighting) it IS established that motivation is the only thing that keeps super-alter users alive. She also didn't WANT to fight Kazuma, so I guess she also felt sorry for what she was doing to him.
* A major sticking point with fans at the end of Part 3 of ''JojosBizarreAdventure'' 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 Giornio fights Diavolo. Giornio is [[spoiler: pierced by the Reqieum 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.
*** It IS the [[spoiler:"mirror" or "shadow" of his opponent's skills just as the Requiem stand normally is, in this case, removing the other half of Diavolo's work]] , so what's missing? Not to say it isn't still worth the trope!
* A borderline case appears in the second season of ''{{Gundam 00}}'': 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 XanatosRoulette), finally achieves it. This, in turn, triggers a hidden system of his machine, the TransAm 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.
* In ''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.
* ''{{Star Blazers}}'' (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.]] Possibly partially subverted as Captain Wildstar had already begun the process of [[spoiler:sacrificing the Argo in a ramming attack]] to achieve the same end.
* A literal Deus Ex Machina is attributed to everyone's survival after the FinalBattle of ''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.
* ''{{Bleach}}'' relies on this quite heavily. In fact, the only reason why Ichigo won during his final fight with Grimmjow is because the latter was suddenly overcome with a bout of stupidity and just ''stood there'' and let Ichigo get him.
** Better yet when Ulquiorra [[spoiler: in his demonic 2nd resurrection form ''kills'' Ichigo by strangling him and ''blasting a hole through his chest,'' Orihime's pitiful wails manage to awaken his inner hollow, who's become über powerful out of nowhere. Said über-hollow then proceeds to totally annihilate Ulquiorra.]]
* ''{{Shikabane Hime}}'' used this in spades in the second season. It became so overused that this troper finds it difficult to go back and explain in detail its every instance.
*[[{{tengen toppa gurren lagann}} Gurren Lagann]] did this over and over... sort of. Essentially a "logical" Deus Ex Machina was set up for the shows entirety with Spiral Energy, literally giving characters the ability to do the impossible ([[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 a DeusExMachina too often can ruin a series"). That's cheeky.
* {{Rahxephon}} employs a Type 4. Many clues are given on what the Rahxephon is supposed to do, the biggest one being a ChekhovsSkill that WILL make absolutely no sense when it is used in the first viewing.
* Mic Sounders of GaoGaiGar is arguably a walking Deus Ex Machina. His Disk P {{Theme Music Power Up}} powers up (and seemingly to a small degree repairs) all of the heroes within earshot (and is also continually used throughout the series). Disk M can disable mechanical systems in only the bad guys (it’s ability to selectively deactivate the bad guys system is in itself somewhat dues 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 GaoFighGar 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.
* A staple of the SailorMoon anime. Two notable instances would be all the heroines dying only to be randomly resurrected; and our heroine throwing herself from a floating island, then inexplicably sprouting wings on the way down.
* ''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]] ([[AllDeathsFinal and futile]]) search for a way to bring her back to life, [[TeenGenius Chao Lingshen]] and [[MadScientist Hakase Satomi]] reveal that they have a TimeMachine]].
[[/folder]]

[[folder:Comic Books]]
* The Marvel Character, [[http://en.wikipedia.org/wiki/Sentry_(Robert_Reynolds) the Sentry]], is so powerful (he had to create a nemesis from his own being in order to counter balance his abilities), that formal story arcs are no longer written about him. Instead, he is used as a "hero" ex machina, bursting in at the critical moment to save other Marvel characters. He is brilliant in that he is an in universe hero, who some would argue is expected to be there to save the day.
** This is averted somewhat in world war hulk, in that ''he was only capable of fighting the hulk to a stalemate''. and then fell unconscious.
* Comicbook/{{Batman}} often solves situations by just happening to have a gadget on hand.
** "[[http://www.youtube.com/watch?v=X0UJaprpxrk Hand me down the shark repellant Bat-Spray!]]"
** On the TV series, anti-[fill-in-the-blank] pills were commonplace, including Anti-Penguin-Gas (taken before attending a town hall meeting held by The Penguin) and Anti-Hypnosis (to block the effect of The Joker's hypnotic music box) pills.
** The worst examples are from the animated SuperFriends version of Batman, in the campy live-action TV series (and related movie) starring AdamWest, and the "wacky" era Batman comics from the 50s and 60s. In the 70s comics (and later), Batman got a bit darker and more serious, and while he still pulls out the gadgets, they tend at least be reasonable things for a prudent superhero to carry around as opposed to, oh, the above-cited shark repellent Bat-Spray (from the Movie).
* The titular character of ''TheAdventuresOfTintin'' 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.]]
** This is probably a good time to point out that serials like Tintin often use deus ex machina because nearly every installment ends with a cliffhanger meant to keep the readers interested in the story. Too keep the plot going, these moments of tension need to be resolved quickly.
* The Flemish comic series ''Spike & Suzy'' has as one of the main characters Jethro, an [[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 ''[[SamAndMaxFreelancePolice Sam & Max]]'' comics by Steve Purcell have had the titular characters narrowly avoiding death using Deus Ex Machina on several occasions for comedic effect. In the very first story, Max is saved from ritual sacrifice when the guy holding the dagger spontaneously combusts.
** And don't forget Sergeant Blip and the Rubber Pants Commandos, they are almost a Deux Ex Machina incarnated; They only appears to save Sam & Max of whathever. Almost everytime without an explanation.
* Brutally and hilariously parodied in ScottPilgrim (even more hilarious when you realize it was actually a ChekhovsGun):
-->Scott Pilgrim - "Oh no! Only a [[LampshadeHanging poorly executed Deus-Ex-Machina]] can save me now!"
-->[[spoiler:Vegan Policeman (to the villain) - "FREEZE! Vegan police. You were caught eating gelato this morning."]]
* Utterly lampshaded in {{Fables}} spinoff ''Jack of Fables'', whose characters include the Literals, [[AnthropomorphicPersonification Anthropomorphic Personifications]] of literary devices. Just as Jack is about to be killed by the Knife-Johns with no apparent way out, Dex - the AP of the Deux Ex Machina - turns up out of nowhere and proclaims that the Knife-Johns all unexpectedly died of instant pneumonia. Which they do. Just to rub it in, he's accompanied by the AP of the {{Fourth Wall}} who's been narrating the story.
* In the “Caged Angels” arc of ''{{Thunderbolts}}'', a group of telepaths mange to infiltrate Thunderbolts Mountain and wreak havoc by mentally controlling the team. The telepaths are finally defeated when Bullseye (who was critically injured in the previous arc and hadn't shown up at all for several issues) wakes up in the hospital and randomly decides to do target practice in the holding cells.
* In certain {{The Creeper}} 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 collets all escaped monsters. He stores them inside the Creeper again and makes Ryder and Creeper shake hands and make up their internal fight.]]
* Superman builds a literal Machina with the Miracle Machine in ''Final Crisis''.
[[/folder]]

[[folder:Film]]
* Subverted in ''Carlito's Way'' when the producers and bigwigs [[spoiler:actually allow the main character Charlie Brigante to die as he's about to escape to paradise]]. In the commentary, the filmmakers joke about whether or not to shoot the "Bullet Proof Vest Scene" before even showing the current cut to their higherups for approval.
* A slightly more sophisticated version of this trope appears in ''TheDarkKnight''. Near the end of the movie, Batman utilizes a super-computer that is capable of spying on every single cell phone in Gotham in order to foil the Joker's last scheme. This computer seems to have appeared out of nowhere, and the fact that Bruce Wayne is a multi-millionaire and can therefore have as many hi-tech gadgets as he wants prevents the audience from asking just how he got it--and why he did not use it earlier.
** Except that the secret construction of the computer is a running subplot. First, Lucius demonstrates the technology on a very small scale in Hong Kong. The [[spoiler:accountant who figures out that Batman is Bruce Wayne]] is clued in by finding evidence of the program. Lucius asks what Bruce is doing with military cell phone contracts, and Bruce responds that he's keeping this one "close to the vest" for the moment. It's really just an answer to a question nobody was asking, because they were too busy watching the Joker.
* LampshadeHanging in ''{{Dodgeball}}: A True Underdog Story'', where the [[spoiler:treasure chest that allows Vince Vaughn to not only save his gym, but buy out his competitor,]] is clearly labeled "DeusExMachina."
** Also a less-than-subtle TakeThat since the original had a downer ending instead...that is, until ExecutiveMeddling.
** How much of the film was re-shot to allow for this turn of events? The odds on the game are reported earlier in the film as being astronomically bad, [[spoiler:White's bribing of Peter]] seems slightly pointless if you remove the ending, [[spoiler:the rule Gordon cites to bring about the deathmatch]] is mentioned much earlier on in the film, the value of White's business is a key factor [[spoiler:in their victory and]] is mentioned earlier as well, [[spoiler:Patches' scarf is given to Peter]] and resurfaces for the final game, [[spoiler:Steve the pirate guy's]] entire character arc seems a bit redundant if you remove the final scene [[spoiler:(where he gets the treasure). Add this to the issue of Kate's sexuality, the Owen/Fran relationship.]] Seriously, so much of the film seems completely pointless if you cut off the happy ending. Next time you watch try to work out how much extra money must have been spent just to secure a happy ending.
** Actually, the downer ending was probably rejected before filming even began, and they re-wrote the script to fit.
* Used spectacularly in ''TheAbyss''.
* In ''RaidersOfTheLostArk'', Indiana Jones [[spoiler: fails in his mission to stop the Nazis using the Ark, and it is literally God who kills them.]] Some extra emphasis on the "[[spoiler: Deus]]" in this trope.
** Except that the Ark was a religious artifact, and the Nazis were trying to take advantage of it without respecting it. Indy survives because he realizes [[spoiler:it's real]], which had been foreshadowed earlier.
* In ''StrangerThanFiction'', Kay Eiffel [[spoiler: uses a DeusExMachina 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 DeusExMachina 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.
* Used magnificently in the climax of ''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.
* In ''{{Shakespeare in Love}}'', [[{{Shakespeare}} The Bard's]] latest play is about to be shut down due to rules against letting women on stage, but then Queen Elizabeth stands up and inspects Viola, and strongly implies Viola isn't female -- and that this queen should know such things.
** Regina ex machina. But wasn't the idea supposed to be that Queen Bess is on Shakespeare's side, and deliberately helping him?
** There's also the line where she asks Shakespeare to come as "himself", heavily implying that she knew when he was disguised as "Wilhelmina" at the court in Greenwich.
* In ''GiveMyRegardsToBroadStreet'', the main conflicts are resolved by our 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. Our 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 we didn't know had the number. That call does get through before midnight.]]
* Parodied in ''History of the World: Part I'' when the horse with the MeaningfulName of "Miracle" manages to TimeTravel in order to arrive to save the hero.
* The timely and stealthy arrival of the T-Rex at the end of {{Jurassic Park}}
** That was not a deus ex machina. The ending of ''Jurassic Park 3'', however, definitely was.
*** Considering the T-Rex is huge and loud, his sudden appearance is hard to explain.
*** The original script had Muldoon coming back to shoot the raptors, but that was changed. The end of 3 is more-or-less faithful to the book, with the Costa Rican government saving the day.
** See the bottom of the article for SamuelLJackson for more on the stealthy T-Rex.
* Employed brilliantly in ''Adaptation'', in which Charlie Kaufman (NicolasCage) is told by a screenwriting guru (Brian Cox) never to use a deus ex machina under any circumstances. Which of course leads Kaufman to employ that very device at a crucial moment at the end of the film.
* Lampshaded / subverted / amazingly executed in a triple entendre by Woody Allen in ''Mighty Aphrodite''. Mira Sorvino's character finally finds love with a good-looking pilot whose helicopter needs to make an emergency landing right next to her. Woody's voiceover exclaims, "Talk about your deus ex machina!" - a surprise resolution achieved through outside intervention, with an Adonis-like figure emerging from a literal machine. The icing on this trope cake is that this ending occurs as an ostensible result of the Greek chorus appealing to Zeus, only to get his answering machine, advising them to leave a message and he'll get back to them. God from the machine, indeed.
** Again spoofed, perhaps even [[DeConstruction deconstructed]] 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 NoFourthWallWhatsoever; 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. Unfortunately, when turned on, it winds up strangling the actor playing Zeus.
-->'''Diabetes''': God is dead.
* ''{{Film/Spider-Man}} 3'': Do you remember that oddly convenient scene with Harry's butler before [[spoiler: his BigDamnHeroes moment and following HeroicSacrifice]]? If that didn't look like something yanked out of a guy's rectum, ''nothing'' will.
** It's suggested that [[spoiler: the butler is Harry's hallucination, representing his good side]].
*** [[WallBanger Oh, well, that's ''miles'' better ...]]
* The {{Godzilla}} films of the 1960s-1970s were notorious for this. The two most infamous examples are the "Flying Godzilla" scene from ''Godzilla VS The Smog Monster'' and Jet Jaguar somehow programming himself to grow to the size of Godzilla in ''Godzilla VS Megalon''.
* The {{James Bond}} films liberally feature number 3. Typically the writers would put Bond in the most impossible situation they could come up with, and then figure out what kind of weird gadget could get him out of it before going back to the Q Branch scene to write in a bit of dialogue about it. Though sometimes they didn't even bother; witness Bond's magnet watch in ''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 {{James Bond}} gadgets.
* The 2008 remake of ''Day of the Dead''. The zombified Bud, despite being a zombie and lacking any explanation, [[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.]]
** Actually, towards the beginning of the movie, Bud explains that [[spoiler: he is a vegetarian]]. Still, it comes off as a {{wall banger}}.
** Also in the 2008 remake, [[spoiler: the virus is explained to be transmitted by air as well as bites]]. When one of the characters asks why everyone around her is uninfected, the scientist explains that "some people are just immune to the airborne aspect"... which just happens to be every single important character in the entire movie.
*** The characters are important because of their immunity. If different people were immune instead, the film would have followed ''them.''
*** Still doesn't address how you can be immune to an airborne virus, but then not be immune to that very same virus in other mediums. You're either immune or you're not.
* The film adaptation of ''WildWildWest''. Loveless's final minion is an invincible human with a metallic endoskeleton, and nothing West does to it even phases it. Apparently the writers realized their mistake a bit too late, and it shorts out for no apparent reason just as it's about to kill West.
** During the fight, West remembers Artemus Gordon's earlier lecture about how hitting metal hard enough will temporarily magnetize it - so he starts wailing away at its metal half-dome with a piece of metal pipe. THAT shorts it out, nudging this a bit closer to a ChekhovsLecture.
* In ''{{Dresden}}'' the protagonist and his love interest are holed up to avoid the carbon monoxide poisoning and fires (yeah, THAT will work), while their oxygen slowly runs out. Then, suddenly the protagonist sees a miraculous chink of light, where fresh air is coming in! They dig themselves out into another room, which has an iron-rung staircase leading out - saved!
* In ''{{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 in ''{{Monty Python And The Holy Grail}}'', both times for laughs. When the characters are being chased by a large animated monster, the animator abruptly has a heart-attack and the monster disappears. The cops at the end are a #4 example, as the movie had been setting them up throughout.
**In Monty Pythons LifeOfBrian when Brian nearly fell to his death, a UFO is flying right at that point.
* Blade's Blade in the film ''{{Blade}}''. Blade is an half-vampire who hunts vampires, and over the course of several killings, he eventually rigged his own sword. This is seen when the love interest character touches the handle of his sword at the secret hideout and a few moments and a few automatic mechanical movements around the handle later, several spikes appear that would cut the hands of whoever would pick up the sword besides Blade himself, who knows how to remove the trap in the sword. Needless to say, a certain dumbass random vampire tries using his sword later in the movie, with the expected effect (even though the trap fired faster with the vampire). This would be a sort of the 4th type of Deus Ex Machina.
* ''CoolWorld'' may have one of the worst. "Noid" (real person) Frank Harris is killed by "doodle" (cartoon character) Holly Wood 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''.
* ''Film/{{Transformers}}: Revenge of the Fallen'' 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 be fair, the problem with real-world [[spoiler: railgun technology]] is that it's a one-shot weapon, OrSoIHeard. I think the random presence of one on a Navy ship is mostly indicative of the gratuitous military glorification in the movie.
**To a slightly lesser extent the {{Macguffin}}, The Matrix of Leadship, 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.]]
**The best example in T:RotF is almost a literal example of the classic meaning. When [[spoiler: Sam dies at the end of the film, he is clealy dead. Resus 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 {{Fluffy Cloud Heaven}}, where a literal machine god in the sky says some guff about how good he is and brings him back to life]]
*In the final installment of ''TheMatrix'' trilogy, [[spoiler: Neo confronts a leader of the machine race, aptly named the Deus Ex Machina, and makes a deal: if Neo is able to eliminate Agent Smith, the machines will agree to a truce with the humans.]]
* {{Undersea Kingdom}}, 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 {{Character Shield}}. (For example, they have important characters collapse on the floor at the end of one episode in a dangerous area, but the beginning of the next, they add a hole that to show they fell on the floor below in a safe area, hoping that people won't remember the nearby dangerous sparks shown while they were collapsing.)
* A spectacularly obvious version happens in ''Beerfest''. After [[spoiler: the fifth member of the team, Phil "Landfill" is killed, his previously unmentioned indentical 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!"]]
* Let's not forget the astonishingly horrific ending to the travesty of modern cinema that was {{Epic Movie}} when one of the characters found the remote from ''{{Click}}'' and paused time to defeat the white bitch who had turned into Davy Jones.
* The god out of the machine that saved the protagonist in ''TheHudsuckerProxy'' was fairly literally a god working in a big machine.
* Played dead straight in WizardsOfWaverlyPlace the movie with the Stone of Dreams, the MacGuffin that Alex and Justin spend most of the movie chasing.
[[/folder]]

[[folder:Literature]]
* Richard Adams' ''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.
** 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 DeusExMachina, you have no idea what Adams is capable of. In his third book, ''The Plague Dogs'', Adams does an AssPull and saves the day, with a [[HangsALampshade poem that is basically a back and forth between the author and the reader]] in which the reader complains that the ending sucks, and the author agrees to change it just to shut the reader up. It was so bad that the movie version's ending is preferred, despite the fact it is basically [[KillEmAll the two dogs drowning pointlessly.]]
* JaneAusten's ''Northanger Abbey'' ended with a DeusExMachina, which felt quite jarring compared to the rest of the book.
** Since that novel is a parody of gothic novels, one assumes that Austen did this intentionally.
* The entire plot of ''JulesVerne's'' ''The Mysterious Island'' is about characters trying to find out why and how someone bails them out of seemingly hopeless situations. (And that "someone", being [[spoiler: Captain Nemo]], does it in the [[BigDamnHeroes most dramatic manner possible]] all the time.)
* In the ninth book of Jim Butcher's ''TheDresdenFiles'', ''Proven Guilty'', Harry Dresden literally banks on a Deus ex Machina occurring. This isn't as farfetched as it seems, as the person he's helping at the time is the daughter of [[ChurchMilitant Knight of the Cross]] Michael Carpenter, who actually 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 Molly fail]], Michael shows up[[spoiler:, having saved the lives of some of the people out to kill Molly, who are required to spare her life in gratitude.]]
* 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 onboard a super-high-tech, top-secret missile that blasts a huge EMP to disable the warships.
* ''The Mill On The Floss'' by George Elliot. When Maggie runs off with Stephen and returns, she is shunned by her brother and has insulted Phil. While sitting in her cabin alone and brooding, a flood rips through the town and drowns our main character before she has an opportunity at reconciliation. References throughout the novel to the flooding of the countryside and water in general place this in the second variety of DeusExMachina.
* Steven Erikson's ''{{Malazan Book of the Fallen}}'' has Dei Ex Machinae 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''.
* In RaymondEFeist's ''Tear of the Gods'', the bad guy, "Bear", kills a bar girl somewhere around chapter 2. Her boyfriend vows revenge. The rest of the book happens, and the good guys finally manage to corner Bear. Unfortunately, they are unable to kill him because he is literally invincible and super strong. Suddenly, the god of vengeance incarnates in boyfriend and strikes Bear down. Good guys return victorious.
* Jasper Fforde's ''The Well of Lost Plots'' -- part of the ''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; when a conspiracy that would have ruined all of fiction was coming to imminent fruition, Thursday activated the device and God came down and fixed everything.
* Played painfully straight in Goodkind's ''SwordOfTruth'': Richard [[ItWasHisSled Rahl]]'s Gift (basically magic) is DeusExMachina. 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]].
* The ''Night's Dawn'' sci-fi trilogy by Peter F. Hamilton. [[spoiler: It's quite literal.]]
** It's foreshadowed from about halfway through the first book in the trilogy, and a group of characters go out specifically to find it- making this a definite example of Type 4.
***"Fridge Brilliance"? Oh obviously, because having a 3'722-page trilogy suddenly resolved in a 15-page [[spoiler: click your fingers and mankind is suddenly transplanted to pseudo-utopia]] section at the end isn't a total anti-climax, is it?
* StephenKing's ''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!"
* The 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 done and the gunmen on the stairs. BUT WAIT!!! Alex remembers seeing a giant orange cone/construction equipment(not mentioned before) and jumps off the building into, allowing him to slide from safety away from his assailants!
* Also by King: ''TheStand,'' regarding which this troper has composed a limerick: Oh, the Superflu caused so much pain, oh! / And with evil a raging volcano / Flagg's triumph seemed certain / Until King rang the curtain / By pulling a ''Deus ex ano!''
* The ''LeftBehind'' series ends with a Deus Ex Machina of sorts, though, given the philosophy put forth in the novels, this is probably intentional.
* Meyer's ''{{Twilight}}''. There are two main reasons in the first three books for why someone wouldn't want to be a vampire: first, the overwhelming desire for human blood, which is incredibly painful to resist, and second, a vampire's inability to reproduce. In the fourth and final book, however [[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, the entire fourth book is crammed FULL of this. [[spoiler: Bella whinges 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 JamesThurber's ''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''.
* [[JRRTolkien J.R.R. Tolkien]] occasionally uses Giant Eagles to whisk his heroes away from danger. These aren't just at the end of ''Rings'', but show up in ''The Hobbit'' to rescue dwarves from burning trees that are surrounded by wolves, to tip the scales in the book's great battle, and in ''Rings'' to rescue Gandalf from the roof of the Tower of Orthanc as well. Tolkien seems to have been unable to resolve the issue of characters marooned on top of high things as well as unable to resist putting them there. Whether these are a Deus Ex Machina is often debated:
** Tolkien called them a dangerous machine that he dared not use often with credibility. He thought them a deus ex machina, though in the books he justified them better.
** The Eagles are Manwë's messengers, so this is a arguably a legitimate case of a true Deus Ex Machina.
** ''Bored of the Rings'' had one of them stamped with "Deus Ex Machina Airlines."
** Common objections: The Eagles' place in Middle-Earth's greater cosmology that's 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]]. Possible objections: Sauron would definitely notice and set up Nazgûl interception and/or tens of thousands of Orcs on the mountain, the Eagles weren't even at the Council of Elrond, Manwë wouldn't send his eagles on a suicide mission, God thinks that defeating evil effortlessly would eventually backfire, Mount Doom is the seat of the greatest power in Middle-Earth and it's uncertain whether anyone could toss away its embodiment there willingly, the Ring corrupts the powerful so that Galadriel and Gandalf refuse to even touch it - and you want to put the thing on Gwahir the Windlord for days on end?!
*** Tolkien's own argument was that the eagles would never allow themselves to be used as taxis by other species.
** Argue all you like about eagles, but the cataclysmic Fall of Numenor was a DeusExMachina in a very literal sense.
** The Army of the Dead (Dead men of Dunharrow). Who are conveniently not mentioned beforehand (why couldn't they help at Helm's deep?)and just happen to be right next to the camp of the one man who happens to be able to recruit them when he just happens to realise he doesn't have enough men to fight the big bad. Convenient? More like shameless. That one wallbanging bit of class 1 uber-Deus ruined the Return of the King for this troper.
* In ''The Kite Runner'', Baba's life is saved by a Russian soldier's officer suddenly appearing and [[FalseGunshot shooting up in the air at the same time the reader and protagonist expect the soldier to be shooting Baba]] for standing up to him.
* ''The lives of Captain Bluebear'' includes a "Mac", a "Roving reptilian rescuer" who flies around the world, rescuing people from certain death at just the last moment. His full name? Deus X. Machina.
** Walter Moers loves playing around with this trope; pretty much all his novels feature SEVERAL of these. And sometimes they FAIL. It's taken to ridiculous extremes at the end of ''Der Schrecksenmeister'', where [[spoiler: a genuine parade of increasingly ridiculous and asspulley Dei ex Machinae show up... and fail to save the main character, one after another.]]
*** Or in ''Bluebear'', where 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 [[LampshadeHanging lampshaded]] improbabilities with a dimensional hiatus save him from a gigantic Spiderwitch; and Professor Nightingale turns up on a cloud of pure darkness. Really, only Mac and Rumo the Wolpertinger ''weren't'' Deus Ex Machinae.]]
* The ''War of Souls'' trilogy of the ''{{Dragonlance}}'' novels ends with a literal version of this trope, wherein [[spoiler:Krynn's whole damn pantheon shows up and thwarts Takhisis (with a little [[HeroicSacrifice heroic sacrifice]] of sorts from Paladine) at the very moment of her final victory]]. This one gets bonus points since the event serves as deus ex machina in at least two ''other'' novels set during that time.
* ''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]]. If you give in to the [[WhatDoYouMeanItsNotSymbolic symbolism]] of everything that's happened thus far, this almost seems [[JustifiedTrope justified]]. Almost.
* ''{{Lord of the Flies}}''. It's supposed to be ironic and symbolic (The DeusExMachina [[spoiler: saves the kid]], but nobody can save the DeusExMachina.), but then again [[WhatDoYouMeanItsNotSymbolic what ''isn't'' in this book?]]
* ''TheInheritanceCycle''.
** 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 unparalleled skills and senses.
* ''WarriorCats'': This Troper can, off the top of his head, remember four instances in the first series where Firestar was about to be killed, but another character came by and killed/chased off whatever was threateing him almost instantly. Three of these four times, Graystripe was the one who saved the day.
** 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.
*** Not really. They'd been setting that up since the previous book.
* Near the end of ''[[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 John Scalzi devoted the closing third of ''Zoe's Tale'' to explaining how exactly she got it - it was ''much'' trickier than it looked from the outside.
* How many fairy tales have one of these? In multiple versions of Snow White and Sleeping Beauty (their Disney versions being huge exceptions), the prince never appears until the end to perform his heroic deed. In Snow White's case, the fact that a kiss can wake her isn't previously mentioned. Rapunzel's tears cure the prince's blindness. A hunter just happens to walk by Grandma's house as the wolf is attacking Red Riding Hood. Although it occurs midway in the story, there is also Cinderella's fairy godmother.
*L. Frank Baum ''loved'' using this. Virtually all of the [[TheWonderfulWizardOfOz 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.
* Spike Milligan's ''Badjelly the Witch''. The titular 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.
* In ''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 ''the common cold'', which martian biology conveniently happened to have no immunity to.]]
* The first {{Discworld}} book, ''The Colour of Magic,'' has some rather literal applications of Deus Ex Machina. There are two that are justified in that [[ChewToy Rincewind]] is Lady Luck's favorite game piece in the tabletop RPG of the gods. Another at the end of the third chapter relies heavily on RuleOfFunny.
* {{JK Rowling}}'s {{Harry Potter and the Deathly Hallows}} climax could constitute the use of a Cut and Paste Deus Ex Machina. [[spoiler:In the final installment of the series, we are introduced to the idea of the Hallows for the first time. Coincidentally, these are items we have seen several times throughout the series. Though the Hallows are referenced and often desired by the main characters throughout the book, the message Professor Dumbledore meant to send by revealing information about the Hallows was to seek the Horcruxes, not the Hallows. Despite figuring this out and following his advice, Harry manages to defeat Voldemort by [[SwordOfPlotAdvancement becoming the master of all three Hallows]]. Not only does this [[TheManBehindTheCurtain subvert Voldemort's skill, reputation, and power]], but it also makes his [[AntiClimax final defeat effortless compared to the rest of the novel.]] This does not even take into account the fact that wand ownership was revealed to be transferable in the final book as well.]]
**From the {{Chamber of Secrets}}, we have the magical car that saves Harry and Ron from the spiders just in time. True, it was in the Forbidden Forest, but that was months ago. The chances of it coming just in time is blatantly impossible, and there's the fact that it would have run out of gas and oil a long time ago.
*** You're worrying about oil pressure in the MAGIC, FLYING CAR?!
**The impression I got about wandlore in Deathly Hallows is that it suffered from fact-becomes-myth syndrome, and the only people who still believe it are people who actually work with wands (like Ollivander and Gregorovitch) and batshit Hallows questers like Xeno Lovegood.
* In HarryTurtledove's ''Wisdom of the Fox'', [[spoiler: the gods themselves rid the world of the monsters, after a personal appeal by the protagonists.]] Cheap.
* Michael Crichton novels live on this. The main characters work heroically to try to solve a problem (which as often as not was created essentially by a couple of bad decisions, followed by a series of events where ''exactly the worst possible thing'' happens in each case), almost but not quite succeeding at several points, only to find out in the end that the problem effectively goes away on its own. To be fair, that can be part of the appeal.
[[/folder]]

[[folder:Live Action TV]]
* Some ''BuffyTheVampireSlayer'' fans would nominate the sudden appearance in "Touched" of a ForgottenSuperweapon in the sewers, immediately followed in "End of Days" by the discovery of a "feminine counterbalance" to the Watchers (who had female members anyway) hiding in a pyramid-shaped crypt that Buffy had patrolled past for the entire seventh season.
** The conclusion of series 4, when they suddenly discover that they can all magically pool their power together so that Buffy is some sort of demigod, allowing a previously nigh-on indestructible foe to be abruptly, casually eliminated with a single blow. They then never use this power again (although this is explained by the potentially fatal nightmares it causes in the next episode).
*** A definite runner up would be Olaf's Troll Hammer suddenly being the weapon of a god.
* On ''{{Angel}}'', Lilah actually uses the trope (although she says ''God'' ex Machina) to describe the situation after Angelus tricks everyone into believing he was Angel again.
* {{Joss Whedon}} seems to be a fan. In the series {{Firefly}}, River Tam ''is'' an embodied, deliberate {{Deus Ex Machina}}. She is unpredictable, and does unpredictable things. Neither the viewers nor the other characters know what she can do, and it is only revealed in small parts e.g. through the ''purposeful'' uses of this trope. As this is deliberately written ''as part of the script'', discovering these quirks becomes an important part of also the viewers' journey. (Consequently, spoiling them here would be somewhat disrespectful towards the writers.)
* When the time came for hosting duties to be handed over on ''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 ''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''
* ''DoctorWho'', "Boom Town", [[spoiler: the TARDIS opens up and reverts the villain into an egg, with no foreshadowing of the event. This conclusion foreshadows the conclusion to a later episode, "Parting of the Ways", in that The Eye is established as a scary and powerful thing -- and this fundamental force of nature twice does completely different things that suit the goals of our heroes because it reads and translates thoughts into reality.]]
**''Doctor Who'' has (either intentionally or inadvertantly -- YourMileageMayVary on whether intent is [[TropesAreNotGood an excuse]]), punned on this trope while pulling it in two instances. In "Parting of the Ways", [[spoiler: the 'machine' (the TARDIS/Eye) transforms Rose into a de facto 'God' ('Bad Wolf'), who proceeds to evaporate all the Daleks.]] In "Last of the Time Lords", [[spoiler: the Doctor is rejuvenated and becomes a godlike figure when the psychic energy of the human race is chanelled through the Archangel network (the 'machine')]].
* ''JoanOfArcadia'' went out of its way to [[AvertedTrope avert]] this. Despite the fact that {{God}} shows up regularly, (s)he only gives instructions to Joan and never acts directly... no matter how much this annoys (or even enrages) Joan. This is most clearly seen with the paralyzed Kevin, whom God could (presumably) heal at any time but never does.
* ''{{Supernatural}}'' /''All Hell Breaks Loose'': Okay, so the gates of hell had been opened but it's still a bit unbelievable/convenient that just as Azazel is about to shoot a restrained Dean, Sparkly!John fights him off just in time for Dean to get the Colt and finally kill the {{big bad}} himself.
* Used repeatedly by MontyPython 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.
* Number 3 features in the {{Wall Banger}} {{Babylon 5}} episode Grey 17 is Missing: Garibaldi makes a big deal of showing of an antique revolver, and in the climax uses its bullets to kill the monster of the week. J. Michael Straczynski didn't even try to put in an explanation for the scene introducing the gun; Garibaldi just says he isn't quite sure why he picked this precise time to take it out and talk about it.
* Type 1 all the way: at the end of 1984's ''{{V}}: The Final Battle'', Diana has activated a thermonuclear device that will destroy Earth. All attempts to deactivate it or remove it from Earth's atmosphere fail. At this time, 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 [[spoiler: hacks into the doomsday weapon's countdown sequence, and inserts an infinite loop]].
* In ''StarTrekDeepSpaceNine'', the founders remove the minefield across the Wormhole, so they can get nearly three thousand ships in reinforcements. This would tip the balance in the Dominion war. Sisko and crew head into the wormhole to [[YouShallNotPass try and stop them]], despite the fact they have no chance. In the Wormhole, they see the thousands of ships and are ready to throw down when the Prophets tell him he can't sacrifice himself because he is important to them and to Bajor. Sisko tells them that he has to try to stop them, then tells them that if they want to save Bajor, they're going to have to do something about the thousands of ships. So they do. What happens no one quite knows. It would have worked better if Sisko had planned to talk with the Prophets, or if he threatened them with extensive collateral damage.
* Type four occurs in the pilot episode of ''DueSouth'', when a baddie disarms Fraser and tries to shoot him with his own gun – which isn't loaded, since Fraser can't legally carry a loaded weapon outside Canada.
* TheStand. Heroes rescued at the end by the actual hand of God.
**Rescued? Blown to shit would be more like it. ''Both'' sides died, good ''and'' bad. God is cruel and victory comes at at a very high price.
* ''{{Medium}}'' had two Deus ex Machinas when Allison was faced with spiritual enemies: [[spoiler: The bad doctor (played by [[BattlestarGalactica 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 interferance.]]
* The new BattlestarGalactica is full of them, more and more as the series progresses, and [[spoiler:it wraps up with a gigantic and very literal DeusExMachina, when God using his "angels" rescues everybody and takes them to a pastoral paradise]]. .
** He/she isn't. God doesn't exactly reach down from the Heavens and huck Galactica at a planet, but it's pretty close: [[spoiler: Starbuck, in her capacity as an angel sent back down to the fleet by God, puts in some coordinates that are basically random that take them to the aforementioned pastoral paradise. That is then christened Earth, revealing that the series actually took place in our distant past rather than the distant future. MindScrew!]]
*** Were you even watching the 4th season? The coordinates are not random at all, they are [[spoiler:''the music'']] and this has been setting up throughout the whole season! This also makes it an even bigger DeusExMachina.
*** If you listen to Ron Moore's podcasts (particularly on the finale), you'll hear him ADMIT that he pretty much made stuff up as he went along. He originally had no idea what the music and the multicolored nova thing meant and just found a convenient use for it at the end. Ever see the RobotChicken episode where he is throwing darts at pictures of cast members to decide who is a cylon? Not far from reality.
*** Not really a MindScrew - that's been LampShaded since the original 70's version
**** Which part? Glen Larson has stated at the original '70s BSG was taking place in Earth's future, and the original plan was to have them arrive at an advanced Earth. All aborted when BSG was cancelled and 1980 had to make due with... well, 1980. The presence of "God" (i.e. the Ship of Lights) and "Satan" (Count Iblis) were both in the original series, but DEM is more like God coming out of nowhere to solve the problem.
*''{{Primeval}}'' had one of these at the end of the most recent series, when a baby raptor just happened to follow Helen and Danny Quinn through an anomaly and then proceeded to leap at Helen, throwing her off a cliff just as she was about to leg it. A real [[IncrediblyLamePun Deus Rex Machina]].
** Since the entire series is about creatures randomly wandering through time anomalies, it's not so much of an example. A much better example is the end of the first season: [[spoiler: The monster from the first episode shows up for no reason and eats the monster of the last episode. Completely awesome, but completely out of nowhere. ]]
* Children's light-drama series BykerGrove had a spectacularly blatant DeusExMachina 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. [[SoYeah Or something like that...]]
* Season 2 of {{Dexter}} had a false DeusExMachina. [[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.]]
* And episode of {{Lost}} titled Deus Ex Machina features a literal case when Locke and Boone find a crashed Beechcraft plane filled with Virgin Mary statues (which turn out to be filled with heroin) and a radio. However, this improbable event [[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 commiting suicide, so this was a real Deus Ex Machina moment after all]].
[[/folder]]

[[folder:Mythology]]
* Funnily enough, there are many times in Greek Mythology where the gods and goddesses fail to do this all the way through; they may do something which only partly rectifies the situation or has its own shortcomings to it - though that may be due to them being JerkassGods.
[[/folder]]

[[folder:Tabletop Games]]
* This is pretty much Modus Operandi for the Legion of the Damned chapter of Space Marines in ''{{Warhammer 40000}}''. They appear without warning and aid beleaguered Imperial forces against the enemies of mankind, then disappear as soon as the battle is won just as suddenly as they came.
* Lampshaded in Munchkin: There's a card called Deus Ex Machinegun that has the gods come down with a machine gun and kill all the monsters, take all the treasure, and make the combat just magically go away.
* In ''{{GURPS}}'', a character can buy an Advantage called Serendipity, which allows one extremely fortunate event per game session to take place at the player's discretion. Who knew "Deus Ex Machina" and "Serendipity" rhymed?
* In SpiritOfTheCentury Players may use their characters Aspects, a Declaration, or even certain Stunts to create an unlikely coincidence happen. Players can also have gadgets and artifacts with undefined abilities, so you can decide that they do exactly what you want at the right moment (of course, once you've decided it stays that way at least until the end of the adventure)
[[/folder]]

[[folder:Theater]]
* In {{Euripides}}'s ''Iphigeneia in Tauris'', the play ends with Iphigeneia fleeing with her brother and his friend. They are pursued over the sea, and a wind appears to make their escape more difficult -- but Athena appears to order the pursuit to stop. Many critics have noted that apparently Euripides introduced the wind, which serves no other plot function, ''solely'' in order to have an excuse to make Athena appear.
** Euripides is actually pretty notorious for this: he did it in ''Alcestis'' and ''{{Medea}}''. {{Aristotle}} called him on it in ''Poetics''.
*** And {{Aristophanes}} made him a character in one of his plays who at one point enters the stage with a crane.
** Another big deus ex machina occurs in the original ''Iphigeneia''. You know that sacrifice everybody's been upset about and Iphigeneia finally accepts? The priests come down in the final scene and say that when they looked away Iphigeneia had been replaced with a pig. Not highlighted for spoilers since she obviously lives if there's a sequel.
* In ''A Midsummer Night's Dream'', [[HilarityEnsues the whole situation gets so snarled]] that eventually fairies have to step in and fix everything. To be fair, they broke half of everything, too...
* The Mozart opera ''Idomeneo'' includes a literal DeusExMachina.
* In the musical ''City Of Angels'', 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!"
* 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'', they all spring back to life and sing about how it's a happy ending.
* Parodied in the Brecht play ''The Threepenny Opera'', where the playwright actually goes to the length of having his characters explain that the play really ends differently... but, for the sake of a happy ending, a royal official enters on horseback to make everything better. The play ends with a comment saying how unlike real life this is.
** There's a brilliant inversion of this trope in another Brecht play, ''The Good Person of Szechuan''. Just as things have got as bad as they can possibly get for the protagonist, Three Gods (who have been present on Earth since the opening scene, and in fact were responsible for the protagonist's predicament in the first place), pointedly do ''not'' step in to resolve matters, and instead mount a giant pink cloud and ascend into the heavens.
** Brecht was very fond of parodying - and thwarting - an audience's need for closure and happy endings, as it was part of his theatrical manifesto to leave an audience ''un''satisfied, and thus hopefully motivated to go out into the world and change things for the better.
* This is the case for a good 90% of {{Gilbert and Sullivan}} operettas.
** Parodied by the ending of ''{{The Pirates of Penzance}}''. Turns out [[spoiler: all the pirates are noblemen.]]
*** Or maybe it's when it when they all instantly surrender when ordered to do so in the name of the Queen. The person who announces that they're all [[spoiler: noblemen who have gone wrong]] [[BlatantLies doesn't seem to have any way of knowing]].
** cf. ''Trial by Jury'' and ''HMS Pinafore''
[[/folder]]

[[folder:Video Games]]
* While ''DeusEx'' - was ''named'' after the trope, it does not really feature this trope, though it does feature a DeusEstMachina.
* Possible subversion in the ''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 and 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.
* Regal Bryant from 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.]]
* ''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 Sonic the Hedgehog 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. To be fair, Sonic is the master of the {{Asspull}} in his own series, as seen below. It isn't SuperSmashBros' fault, since it's very in-character for SonicTheHedgehog]]
** The only inclination the player had about that is that [[spoiler:Sonic hadn't shown up yet, despite being the most awaited character in the game.]]
** It's not so much an AssPull as it is shoe-horning a late addition into the story without a major re-write. Unless that is an AssPull.
* Parodied in (where else), BanjoKazooie Nuts and Bolts with the [[DungeonMaster Master of Games]]. Technically, his powers are limited in that he only can control {{Video Game}}s...but given that this ''is'' a VideoGame, his power is at RealityWarper levels.
* ''SonicTheHedgehog''. Throughout the series since Sonic & Knuckles/Sonic 3 & Knuckles all the way to the current generation of Sonic video games, Sonic and certain other characters have used the Chaos Emeralds (or other mystical items such as the Super Emeralds, Sol Emeralds, and World Rings) to use the Super transformation (as well as other transformations such as Darkspine Sonic, Burning Blaze, and Hyper Sonic) which has always appeared as a last resort to defeat the last boss in the game with the exception of Super Sonic's appearance in Sonic the Hedgehog 2.
** The Chaos Emeralds' use as a DeusExMachina has gotten even more frustrating than that with recent games. Originally, Chaos Emeralds were just sources of energy, explaining how they gave characters super transformations. But recently, they have been given the ultimate {{Asspull}} ability to grant wishes and travel through time. As of Sonic 2K6, they can bring people back from the dead with a few lines of prayer and a bestial kiss.
** To be fair with Sonic, they usually go out and COLLECT the items BEFORE the final boss. Seriously. In nearly every (if not all) handheld Sonics, you have to find the emeralds in secret missions. In Sonic Adventure 2, the bad guys had already collected the emeralds before the final fight to power the cannon. In Secret Rings, you had to find the World Rings in bonus missions. The whole POINT of Sonic Unleashed was to find emeralds to put the planet back together and take down Dark Gaia! However, at the intro of Unleashed, I have absolutely no fucking clue how those emeralds appeared out of Sonic when he was captured, but Eggman had counted on him going Super Sonic, because we all know what happens then... So technically, they're already prepared when that happens, so it's not really an asspull.
* In ''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 sitaution 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.
* In ''CallOfDuty4'', during the final FissionMailed sequence, after the DiabolusExMachina Hind appears and disables or kills most of your squadmates, Soap and Price are helplessly wounded and the rest of the squad executed, with the BigBad about to finish them off, then Russian Loyalist helicopters arrive and distract the BigBad, allowing Price to throw Soap a pistol to kill the BigBad. Soap is airlifted, but Price has apparently been KilledOffForReal.
**Probably not, considering it had already been established that the Loyalists were on their way.It was merely a question of whether they'd make it in time or not. Obviously, They didn't
* Occurs in almost every final boss battle in the ''ResidentEvil'' series, where the hero is thrown a rocket launcher or some other BFG.
** Also whenever a main character gets infected with a virus, there's always a vaccine somewhere nearby that someone conveniently left behind for the main character to use.
* During the final battle in ''Super {{Metroid}}'', Samus gets saved at the last moment after getting zapped and stunned by the final boss. Considering this moment and what happens right after is frequently considered a CrowningMomentOfAwesome (and TearJerker), this is arguably a DeusExMachina done right.
* 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.
* At the end of {{EarthBound}}, the player characters are absolutely helpless until ''the player him/herself'' kills the final boss.
* The dramatic mood of the scene betrays the fact that the 'Azoth Dagger' from ''[[FateStayNight Fate/Stay Night]]'' came out of nowhere. The fact that Rin had been brutally assaulted such that there is no way she could have hidden it, makes you wonder about the possible meanings of it's name...
* ''[[MegaManX MegaMan X6]]'' had a huge ass pull when regarding the return of Zero. Despite being blown up with nothing but an upper body torso left in ''X5'', he appears healthy and alive in ''X6'' with [[IGotBetter 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.
** Then there's X being repaired in X5's ending. Who the hell repaired that guy so quickly after the battle? Many assume it was Dr. Light who did so, but he's dead.
*** It's not too far-fetched, as Light pretty much is the [[CrazyPrepared Goddamn Batman]] of that universe. The man's got, like, 1000+ pods, for crying out loud!
*** Not to mention it's fairly obvious that Doc Light's hologram is semi-sentient. Although the question of ''why'' he would revive X into a war-torn future when all he wanted for him was to live in peace...I guess he either really likes X, or really ''hates'' him.
*** The first game states that X was brought out of stasis during a time after an immense war. Then other robots were modeled after him, and then they went crazy. And so Light was all, "Hey X, you have a gun and I have some crazy upgrades, I didn't want you to use them, but do so now so you can save the world."
* One scenario in ''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.
* The G-Man in ''{{Half-Life}} 2''. Also, the purple Vortigaunts at the beginning of Episode One.
** This one might not apply, both are frequently shown to actually be watching Freeman and stepping in when appropriate. At one point you can see the G-Man giving some rebels a rocket launcher they later give you to use, so it's more like a huge XanatosGambit than anything else, and the Vortigaunts seem to have their own going as well. Hopefully we'll get some answers in Episode 3, but don't hold your breath...
*** The G-Man dragging Freeman off and bringing him back is a DeusExMachina in itself just to allow the second game to happen. Unless they retcon in some motives for him, anyway.
[[/folder]]

[[folder:Web Comics]]
* LampshadeHanging: In ''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 "DeusExMachina!". 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.
* In an apparently unintentional [[LampshadeHanging lampshaded]] example, Miranda of ''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]]"
* Justified: ''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).
*** You can't microwave things in cans.
**** Who would want to microwave goodness?
***** The King of Hell, presumably...
** The "Holiday Wars" arc plays with it and [[DoubleSubversion double subverts]] the DeusExMachina. 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.
* The plot of ''{{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.
* Doctor McNinja hangs a lampshade on this [[http://www.drmcninja.com/page.php?pageNum=9&issue=3 here]].
* [[DinosaurComics T-Rex]] explains it in his inimitable style [[http://qwantz.com/archive/001354.html here]].
* [[http://www.somethingpositive.net/sp02132009.shtml The resolution]] of the sexual harassment subplot in ''SomethingPositive''.
** Fits to a tee, but not the first time it's happens. So at least the author can claim he din't ''completely'' [[AssPull pull out from nowhere]].
* {{Schlock Mercenary}} on several occasions. Also lampshaded [[http://www.schlockmercenary.com/d/20050319.html here]].
* ''OrderOfTheStick'': 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 reuinites them back with their friends does not help.
** There is WildMassGuessing that it can do that because it has Wish as a spell-like ability. However, almost all creatures with such abilities are Outsiders, which have oddly-colored SpeechBubbles in OotS. The [=MitD=] has normal SpeechBubbles.
* 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).
[[/folder]]

[[folder:Web Original]]
* [[LampshadeHanging Lampshaded]] 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".
* Critics of the ending to 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 his dead friends may have been protecting him.F
[[/folder]]

[[folder:Western Animation]]
* In an episode of AmericanDad, just when Stan and his family are about to be stoned to death, George Bush and the army arrive to save them with the line "Democracy has arrived!", throwing an American flag through the judge. Instantly, all of Saudi Arabia becomes some kind of democratic paradise, and Stan gives a line parodying the end of ItsAWonderfulLife. However, none of it mattered in the end, as it was AllJustADream.
** Though ANOTHER DeusExMachina took place in the form of Roger using his "husband"'s apparent political influence to call the Saudi executioners just in time to call off the stoning and free the Smiths.
* ''{{Megas XLR}}'' got most of its humor from the fact that the titular HumongousMecha was a literal DeusExMachina. In fact, one of the numerous buttons on its control panel was even marked "Save the World" (which was actually missing).
* Spoofed in the ChristmasSpecial ''Olive, The Other Reindeer'': Olive gets locked in the van of a mean-spirited mailman who wants to ruin Christmas, and escapes with a set of wire cutters found in a box marked "To Olive, from Deus X. Machina".
* Parodied on ''TheSimpsons'' in an episode where Homer is the only person called up to Heaven after the Rapture; when he asks {{God}} to put things back the way they were, God raises His hands skyward and shouts "''Deus ex machina!''", after which everything goes back to normal.
** Another episode sets up the ending like this is the ''only'' way out. Homer and a little girl are trapped on a tiny island in the middle of the lava - on a tiny island in the middle of the ocean - and we're just waiting for the rescue helicopters or something equally incredible to save them. But the show suddenly stops and some commentators laugh and wonder how they're going to get out of ''this'' one. And by the way, it's Pledge Drive Week, so phone in now... (The show is intentionally [[NoEnding left unresolved]].)
** Don't forget the LordOfTheFlies parody episode where all the kids are left stuck on the island at the end and James Earl Jones, in a voiceover narration role, says that they were eventually saved by "...oh, let's say, Moe".
* The ''{{Disney/Aladdin}}'' TV series [[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.
* At the end of the ''TransformersGeneration1'' 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 ''TransformersSuperGodMasterforce'', The Autobots are revealed to be equipped with non-lethal knockout gas just as Decepticon zombies attack Rome.
* The ''SpongeBobSquarepants'' movie writes itself into a corner that can only be rectified by a wonderfully ridiculous parody of TwistedSister's I Wanna Rock. The villain's plans are undone by the explosive power of rock music. Once the smoke clears, SpongeBob is left dangling on a the end of a rope suspended above the stage in a neat reference to the literal Greek tragedy deus ex machina.
** Not to mention David Hasselhoff.
* ''AvatarTheLastAirbender'': [[spoiler:The lion-turtle and Spiritbending]] were given purely visual teases and no mentions in dialogue. Even though it looks like the creators had them in mind for a while, they end up being brought to the fore ''very'' abruptly.
** Mike and Bryan have implied as overtly as their contract will allow them that they dislike how they had to resolve the story, and also bemoan how they didn't have time to tie up the Ursa-subplot. Apparently, they did plan on giving a lot of stuff more/better closure and explanation, but didn't have time ([[ExecutiveMeddling or got cock-blocked by the doods with the money)]], which is strange, as there were several episodes that could have easily been removed. It makes one wonder if a lot of the filler in season three was something [[PanderingToTheBase they were forced to do to score better]] with the {{Periphery Demographic}}. It may be years until the fandom gets the whole story on this.
** Speaking of Avatar, when Aang suddenly gets his back hit by a sharp rock, his avatar state, which was taken away by Azula in the season 2 finale, is given back. Because he's hit where Azula hit him. This happens when he's about to die at the Fire Lord's hand, at the last (or was it second to last?) episode. Cue Aang [[CurbstompBattle Curbstoming]] The crud out of the Fire Lord with all four elements. DeusExMachina if there ever was one, in my view.
*** Not necessarily. Katara mentioned very early on that he had 'a lot of pent-up energy here', which suggested that his chakras were blocked and tense, and a strike there unleashed all of that suppressed avatar state energy at once. Granted, it could have used a little more buildup.
* ''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.
* ''PhineasAndFerb''. Just... Phineas and Ferb.
**it should be noted that this is mainly for humor, and has come to be accepted, as it happens every episode
*''TeenTitans'' loved doing this.
**Season 3: Cyborg is the only Titan left who can resist Brother Blood's MindControl. 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 lampshaded it this time.
-->'''Beast Boy''': [[DoingInTheScientist So are you magic now or something?]]
-->'''Cyborg''': 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 before hand that something like this was possible or that Blood had anything but complete control over his powers. This is especially jarring precisely because it ''wouldn't have taken much foreshadowing to establish the mechanic beforehand''. Sigh.
**Season 4: Raven embraces the PowerOfFriendship, reverts to her age, and gains complete control of her powers long enough to blast her evil father into oblivion.
*** Two things. First, this is sort of a literal usage, as Raven's father is not just evil, he's apparently the universally acknowledged god of evil (in the original comics, he was referred to as the devil), and being half-deity is the source of all her powers in the first place. Second, she'd had complete control over her powers for the entirety of the series, it's just that Trigon wouldn't let her use them against him during his invasion, and I thought that that scene was kind of her realizing that "You have no power over me."
*** There's also the fact that it's been extablished as early as the sixth episode of the first season that Raven's powers are based on her emotional state- despair would literally be enough to sap her of them, and the decision to stand up and fight her father for the first time ever would be enough to supercharge them.
**In an episode that shows how the original five of the team met each other, there is an alien race after Starfire, and the only way to stop them from destroying the city is to beat the leader. Cyborg has managed to track down the location of the leader's ship with a soundwave device in his right arm. The titans fight the leader and are basically at a stalemate. Suddenly:
--> Robin:(Motioning to soundwave device)Can you rewire that into some kind of weapon?
--> Cyborg: I can try...
And he does, taking out the leader in one shot with his new arm cannon.
* The finale of ''Beast Wars'': the Maximals, holed up in Teletron 1, are getting pommeled by the Decepticon warship Megatron just found. They find a working shuttle in one of the bays, one that NO ONE knew about for the WHOLE SEASON, and it is immediately pointed-out that "There were no shuttles that survived the crash [of Teletron 1]." They take that shuttle, kamikaze it into the enemy ship, and then fly home on it ... effectively making it that "There were no shuttles that survived the crash."
[[/folder]]

[[folder:Real Life]]
* The ''shinpu'' (in English, "Divine Wind", also known as "kami kaze") were a set of typhoons in the years 1274 and 1281 which prevented Mongol invasions of Japan.
* Likewise, two of the worst winters in Russian history were the years that Napoleon and Hitler invaded Russia, and the harsh weather were big factors in their defeats.
* 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 patters that allowed William 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".)
* Really, while this may be one of the most negatively-viewed tropes around, it occurs often enough in real life.
* Sacagawea. Just Sacagawea.
* [=McClellan=] won the battle of Antietam (for a certain value of "won") because an Army of N. Virginia officer used his copy of Lee's orders for the campaign to wrap a few cigars, which he then accidentally dropped on the ground. A couple of Army of the Potomac soldiers then found the cigars, and the orders. One of [=McClellan=]'s officers was able to recognize the handwriting and verify the orders as genuine. Of course, [=McClellan=] still couldn't bring himself to move fast enough to wipe out Lee's army, but he still defeated Lee's offensive campaign into Maryland. That, in turn, was enough of a victory for Lincoln to go ahead and issue the Emancipation Proclamation. Yeah, that all really happened; there are some plot twists only G-d can get away with.
[[/folder]]
* The military battles/wars of the modern State of Israel, enough so as to be viable discussion material (look up the documentary series ''Against All Odds'') as to whether proof ''plainly'' exists as to the existence of the aforementioned G-d. [[{{Squall}} This troper]] votes a firm yes.
----
<<|NarrativeDevices|>>
<<|ContinuityTropes|>>
<<|InDexMachina|>>
<<|JustInTime|>>
<<|TropesOfLegend|>>