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

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

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

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

The term is Latin for "god out of the machine" and originates in [[OlderThanFeudalism ancient Greek theater]].[[note]]the original classical Greek "theos ek mekhanikos" became "deus ex machina" through Latin translations of Greek literary criticism in the Renaissance[[/note]] It referred to scenes in which a crane (''machine'') was used to lower actors or statues playing a god or gods (''deus'') onto the stage to set things right, often near the end of the play.

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

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

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

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

''Also'', please make sure an example meets '''all 3 criteria''' before submitting. This is a not a place to [[Administrivia/ComplainingAboutShowsYouDontLike Complain About Plot Twists You Don't Like]].
!!Examples (Warning: Ending Spoilers)
* [[DeusExMachina.AnimeAndManga Anime and Manga]]
* [[DeusExMachina.ComicBooks Comic Books]]
* [[DeusExMachina.{{Literature}} Literature]]
* [[DeusExMachina.LiveActionFilms Live-Action Films]]
* [[DeusExMachina.LiveActionTV Live-Action TV]]
* [[DeusExMachina.VideoGames Video Games]]
* [[DeusExMachina.WesternAnimation Western Animation]]


* In ''[[http://rugratonline.free.fr/rrfan35.html The Great Pokemon Fight]]'', [[WesternAnimation/{{Rugrats}} Tommy]] is mortally wounded by [[Franchise/{{Digimon}} Greymon]] during a heated battle to save the Poke-Digital World... And just as Greymon tries to finish off Tommy, he, along with his army, then just disappeared. Like, poof, bye bye. Heck, the story even says that they just disappeared for no reason. No one even questions this as they were too busy on the dying Tommy. Then he dies, and suddenly, [[Franchise/{{Pokemon}} Mew]] comes out of nowhere and revives him. In total, there's ''two'' Deus Ex Machinas in the span of a minute.
* ''Fanfic/ACrownOfStars'': Deliberately invoked. After the events of canon and the preceding fic, Shinji and Asuka were physically burned-out and emotionally ''wrecked''. This story's author wanted to try to give them a happy end, and he thought that [[http://forums.sufficientvelocity.com/posts/2293239/ it would be ironical that it would take actual divine intervention to get them to fricking talk to each other]]. So that in the first chapter a GodEmperor called Daniel appeared in front of Shinji and Asuka and offered to help them. It is more justified than other examples since Daniel serves as a plot device to start the story, rather ending it, and although he can help them, he can not automatically fix all of their troubles or changing the past, and the story focuses on Shinji and Asuka and their struggles to recover from their traumas and repair their relationship. And when the main external conflict begins, the main characters are cut off him, so that he can not bail them out.
* In ''Fanfic/InThisWorldAndTheNext'', [[Literature/HarryPotter Harry and Hermione]] are sentenced to the [[FateWorseThanDeath Dementor's Kiss]] for killing RonTheDeathEater. Instead, the Dementor ''[[MadeOfExplodium explodes]]'' and releases their life force, allowing them to [[PeggySue go back in time]]. A bit more Justified than other examples, serving as a plot device to ''start'' the story, rather than the more common use in ending it.
* In the season 4 finale of JakeEnglishsMysteriousTheaterOfScientificRomanceFromTheYear3000, after being rescued Zeus declares all the other plot threads to be resolved.
* ''Fanfic/KnowledgeIsPower'': There's not really any other way to describe Harry and Hermione being sent into the past by the ghosts of James and Lily when [[RocksFallEveryoneDies a ceiling falls on them]].
* ''Fanfic/MyLittleUnicorn'':
** The Uniforce. A force of good only unicorns with golden horns can summon to amplify their magic by shouting that they believe. It is never explained what it really is, why only golden horned unicorns can use it and how the Grand Ruler discovered it, but it is the main attack to kill all {{Big Bad}}s.
** Mystic Light, the finishing move of [[spoiler: The Grand Celestial Ruler]].
* Chillingly done in the Pokémon fic Fanfic/NoAntidote. [[spoiler: After realizing a poisoned trainer is completely an EmptyShell, a ghost Pokémon, under orders from Giratina, takes control. The motives claim to be for the benefit of the "Starter" Pokémon that unquestionably follow their leader but...]]
--> [[spoiler: ''Ghost Controlled Trainer'']]: This is the most fun we've had in decades!
* In ''Fanfic/TealovesSteamyAdventure'', the cast face a seemingly hopeless fight against a giant, mobile pear tree. Then, Fluttershy appears from nowhere (the narration just states that she was hiding behind a cart the entire time) and [[SummonBiggerFish summons a flock of fruit bats]] to take out the tree.
* Happens a bunch of times in Fanfic/TwilightSparklesAwesomeAdventure:
** The new lead guard [[MemeticMutation takes an arrow to the knee]] before he can shoot Twilight. This is in a setting where guns are the weapon of choice and no character is ever shown to have a bow.
** At one point Twilight notices a hatch in the ground with a ladder in it ''inside a broom closet'' which helps her avoid a [[SpaceIsAnOcean space shark.]]
** [[spoiler: Slenderman appears out of nowhere to save Rainbow Dash from the gay snake.]]
** [[spoiler: ADMIRAL Awesome comes BackFromTheDead to save the heroes at the end of the Last Part.]]
* ''Deus Ex Rannoch'', a minor ''Franchise/MassEffect'' fic where the Refusal ending is overwritten by a [[spoiler:hidden geth/quarian empire big enough to defeat the Reapers]].
* Episode 75 of ''FanFic/SonicXDarkChaos'' has a big one. Maledict has [[TheBadGuyWins lured the heroes into his trap and takes the entire galaxy hostage with the Galaxy Crusher in exchange for the Chaos Emeralds]], leaving the heroes in a literally hopeless situation. Suddenly, a gigantic Angel fleet led by Jesus Christ himself suddenly shuts down Maledict's trap and ambushes his fleet.

[[folder:Films -- Animated]]
* The Disney film ''Disney/TheBlackCauldron''. While the cauldron is the first artifact and/or character introduced, the way it qualifies is how it takes out [[spoiler:The Horned King]]. While it was explained that a living person entering the cauldron of his or her own free will would seal its powers, it is not explained why it kills the guy and destroys the castle. It's implied that it's just that evil, but that's a rather [[HandWave flimsy explanation]]. It is also highly anticlimactic, because the [[spoiler: King]] doesn't get to DO anything, despite being hinted as being a powerful sorcerer. Another is supplied by the witches, who [[spoiler: revive the person that jumped into the cauldron]]. And why is it that the witches have this cauldron in the first place and the heroes practically fall on top of apparently the only society that knows where they are?
* A literal case in Disney's ''Disney/TheHunchbackOfNotreDame'':
** The BigBad spends the movie on a reign of terror that he proclaims to be for a higher cause, sings a VillainSong that's an inverted confession of sins, and assaults a cathedral. When he's swinging a sword and raving about how He shall cast down the wicked, the gargoyle under his feet roars at him and breaks off.
** The movie shows Frollo becoming gradually more unhinged. The gargoyle started to crumble under his feet, and he grabbed onto it to keep from falling, but it still detached from the wall. He could have been hallucinating the bit where it actually came alive.
* A semi-literal example is the WelcomeToTheRealWorld scene in ''WesternAnimation/TheLEGOMovie'', in which Emmett dives into the void to retrieve the Piece of Resistance and falls out of the model into the real world, where he sees a vision of the child playing LEGO... and his [[StopHavingFunGuys rather less fun]] father. He eventually manages to persuade the kid to give him the Piece and put him back into the story, with him zooming out of the portal [[HomageShot like Neo at the end of]] ''Film/TheMatrix''.
* An example in ''Disney/{{Mulan}}'' II, when it is employed in the original style as Mushu climbs into an idol of the Unity Dragon and makes supposedly divine pronouncements (punctuated with a bit of fire-breathing) that neatly resolve what has become a very tangled situation.
* The end of the ''WesternAnimation/TheSecretOfNIMH'' film just ''screams'' Deus Ex Machina. Supposedly, the "stone" that does [[MacGuffin something... powerful]] manages to respond to Mrs. Brisby's... emotion and then pulls the cinderblock out - with no loss of life (or mud, which had been flooding the house). Auntie Shrew likely survived because she fell into a PlotHole when the mud started flooding the house.
* PlayedForLaughs in ''WesternAnimation/TheSimpsonsMovie'', where Maggie shows up to defeat the villain completely out of nowhere.
* Towards the end of ''WesternAnimation/SouthParkBiggerLongerAndUncut'', Canadian comedians Terrance and Phillip are gunned down by Kyle's mother, triggering Satan and Saddam Hussein's takeover of the world. All seems to be lost until Saddam insults Satan one too many times after receiving several brutal electric shocks from Cartman's V-chip. Satan finally stands up to Saddam and kills him, thanking Kenny for giving him the courage to get out of his abusive relationship, and grants him one wish. Kenny's wish is for all the horror and tragedy of the US-Canada war to be undone, even if it means going back to hell himself. [[ResetButton Within a matter of seconds, everyone who died in the war is revived and Canadian/American relations are restored.]] Also, instead of going back to hell, as a reward for his sacrifice, Kenny [[spoiler: is sent to heaven where he is greeted by large-breasted angels.]]
* ''WesternAnimation/TheSpongebobSquarepantsMovie'' writes itself into a corner that can only be rectified by a wonderfully ridiculous parody of Music/TwistedSister's I Wanna Rock. The villain's plans are undone by the explosive [[ThePowerOfRock power of rock]] music. Once the smoke clears, [=SpongeBob=] is left dangling on the end of a rope suspended above the stage in a neat reference to the literal Greek tragedy deus ex machina.
* ''WesternAnimation/TheSecretOfTheHunchback'' has an egregious example: [[spoiler:In the ending, Quasimodo seems to fall to his death, but then... he GROWS WINGS!]]
* The [[spoiler:healing tears]] at the very end of ''Disney/{{Tangled}}''. While the movie is different in many ways from the original fairy tale, this detail comes straight from the source material. [[spoiler:The fact that her healing powers were rather mysterious to begin with may also be a factor]]. However, nothing in the movie itself foreshadows it in any way.
** Unless you believe the theory that [[spoiler:the drop of sun from the intro IS the tear that saved Flynn.]]
* '''THE CLAW''' at the end of ''WesternAnimation/ToyStory3'' is a ''[[FridgeBrilliance literal]]'' Deus Ex Machina, as the DVD commentary points out, given that the [=LGMs=] treat "the claw" as their deity and it is also the machine that [[spoiler: saves all of the toys from burning in the garbage furnace.]] Its arrival is accompanied by a choir of angelic voices on the soundtrack.
* The Amnesia-inator in ''Phineas and Ferb: Across the 2nd Dimension'', as even though it was established that OWCA has been duplicating Doofenshmirtz's Inators, that one was never seen before in a previous episode. Likely PlayedForLaughs, though, especially with Doofenshmirtz's response of " I think I'd remember building something like that!" to probably suggest that the original backfired and gave ''him'' amnesia thus forgetting he built it.
* It would take a while to name the Deus Ex Machinas in just about every classic {{Barbie}} movie. Justified, because these ''are'' films for little girls aged 3-7, after all.

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

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

[[folder:Radio Drama]]
* While writing the first installment of ''Radio/TheHitchhikersGuideToTheGalaxy'', Creator/DouglasAdams found himself faced with a writer's dilemma: His characters had just gotten thrown out an airlock, and would pass out and die from lack of oxygen in 30 seconds, and it was so utterly improbable that another spaceship would come around within those 30 seconds to rescue them that to have had that happen would've been nothing short of this trope. This gave him the idea for the Infinite Improbability Drive.

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

[[folder:Tabletop Games]]
* In ''TabletopGame/DungeonsandDragons'', the high-level Cleric spell Miracle allows you to request intervention from your deity. It costs experience points to use in that fashion, but other than that the only stated downside is that the deity might refuse.
* ''[[{{TabletopGame/FateOfTheNornsRagnarok}} Fate of the Norns: Ragnarok]]'' allows player characters to ask a deity to help them in battle. A sacrifice is performed, runes are drawn, and if the aforementioned deity is in a good mood, Deus Ex Machina may occur. However, if your prayer has ''angered'' it, the divine intervention will benefit your opponents!
* In ''TabletopGame/{{GURPS}}'', a character can buy an Advantage called Serendipity, which allows one extremely fortunate event per game session to take place at the player's discretion. The Gizmos advantage is designed to let players imitate fictional characters like Batman and James Bond, as described above.
* The parody RPG ''TabletopGame/HoL'' has the "Grace of God" pool, which players can put points in by rolling {{Critical Hit}}s during the game. If the character cannot get out of a situation and has points in Grace of God, they can say "Praise Jesus", which allows the DM to use any random, nonsensical, and/or inexplicable means they can think of to solve the character's dilemma.
* In the tongue-in-cheek RPG ''TabletopGame/InNomineSatanisMagnaVeritas'', which is played with rolls of 3d6, anyone rolling 111 means a direct and usually over-the-top divine intervention happens. Which can be a very good thing if you're playing an angel, and a very ''bad'' thing if you're a demon. And of course, a roll of 666 causes a direct satanic intervention. Also, any angel can try to summon his archangel, and any demon can try to summon his demon prince. And yes, it ''can'' work... If you're lucky.
* ''TabletopGame/MagicTheGathering'' has the "Miracle" mechanic. Cards with Miracle are all powerful, expensive spells. However, if they're the first card their owner draws in a turn, they can be immediately played for their (deeply discounted) Miracle cost, making them a sudden solution to many a hopeless scenario.
* Lampshaded in ''TabletopGame/{{Munchkin}}'': There's a card called Deus Ex Machinegun that has the gods come down with a machine gun and kill all the monsters, take all the treasure, and make the combat just magically go away.
* ''TabletopGame/{{Shadowrun}}'' actually has a rule about this, called Hand Of God. When a PC ends up in some sort of [[NoOneCouldSurviveThat hopeless situation]], the PC's player can invoke the Hand Of God, having the GM save the PC via some form of Deus Ex Machina. There's a catch, of course: it has a hefty experience-point cost, and it can only be used once per character.
* In ''TabletopGame/SpiritOfTheCentury'' players may use their characters' Aspects, a Declaration, or even certain Stunts to make an unlikely coincidence happen. Players can also have gadgets and artifacts with undefined abilities, so you can decide that they do exactly what you want at the right moment (of course, once you've decided it stays that way at least until the end of the adventure)
* ''TabletopGame/WarhammerFantasyRoleplay'' and ''TabletopGame/DarkHeresy'' have the [[OneUp Fate Points]], which will unfailingly pull a character out of certain death and put them in a position where you are safe for the immediate moment. For small stuff a Fate Point will turn a killing blow to a glancing one, cause the enemies to take you prisoner instead of killing you on the spot, or let you dodge that lethal fall pit, but it becomes one of these when, say, you've just been killed by being spaced, caught inside a collapsing mine or building, or by having a daemon biting your head off.
* This is Modus Operandi for the Legion of the Damned chapter of Space Marines in ''TabletopGame/{{Warhammer 40000}}''. They appear without warning and aid beleaguered Imperial forces against the enemies of mankind, then disappear as soon as the battle is won just as suddenly as they came. Notably, this is one that creeps out the Imperials something fierce. Interestingly, one of the theories behind the Damned Legionnaires' appearance is that they are extensions of the God-Emperor's will. Although he's more like [[{{Pun}} Deus IN Machina]]. [[spoiler:[[DontExplainTheJoke You know, the Golden Throne?]]]]
* An actual game mechanic in ''World of Synnibarr'' (really). If your character is on the verge of death with no hope of salvation, you actually get a ''dice roll'' to see if your patron deity turns up to haul your arse out of the fire.
* For some {{Game Master}}s, this is going to happen eventually. Whether it be a TotalPartyKill where it shouldn't be, the players making a decision that turns out to be much worse than they could imagine, or other misadventure, a group of players will find themselves in a situation where the only way out is to basically cheat. Some [=GMs=] will just rewrite the then-latest events, but for [=GMs=] who like to maintain the narrative, this may be the only way out.

* In the prologue to his ''Amphitryon'', the Roman playwright [[Creator/{{Plautus}} Titus Maccius Plautus]] parodied and {{lampshade|Hanging}}d this trope somewhat by having the god Mercury explain to the audience that there's a precedent for having the gods be active characters in this play: wasn't it just last year that somebody performed a play on this very stage in which someone in dire straits called on Jupiter and (lo and behold) out popped Jupiter to save the situation?
* In the musical ''Theatre/CityOfAngels'', writer Stine finally snaps after witnessing the culmination of the ExecutiveMeddling on his FilmNoir screenplay, and the producer sics the studio cops on him. Detective protagonist Stone (appearing as Stine's SpiritAdvisor after his part was brutally miscast by the studio) goes over to Stine's typewriter and does a little RewritingReality, making Stine beat up the cops and defeat the producer. For an encore, Stone types a little more and reunites Stine with the wife he cheated on: "A Hollywood ending!"
* In Creator/JohnMilton's ''Theatre/{{Comus}}'', the Spirit complains that the brothers let Comus get away with his MagicWand so they can't free their sister -- but wait. He recounts the tale of how Sabrina (previously unmentioned) [[DeityOfHumanOrigin became a goddess]] and then calls on her to help them, which she does.
* Spoofed, perhaps even {{deconstruct|ion}}ed by Woody Allen in his one-act play ''[[http://members.fortunecity.com/bookdepository/plays/god/god2.html God]]'', an excellent if strange production which has NoFourthWall whatsoever; it's nominally about two Ancient Greeks trying to put on a play right there, when [[ThemeNaming Trichinosis]] shows [[ThemeNaming Diabetes]] his new invention, a machine for lowering the gods to the stage in order to solve characters' problems. (He boasts that he's going to make a fortune with it: "Sophocles put a deposit on one. Euripides wants two.") Unfortunately, when turned on, it winds up strangling the actor playing Zeus.
-->'''Diabetes''': God is dead.
* The Mozart opera ''Idomeneo'' includes a literal example. Idamante is about to be sacrificed to Neptune, when the god's voice proclaims that he is to live instead and take the throne from his father.
* In Creator/{{Euripides}}'s ''Iphigeneia in Tauris'', the play ends with Iphigeneia fleeing with her brother and his friend. They are pursued over the sea, and a wind appears to make their escape more difficult -- but Athena appears to order the pursuit to stop. Many critics have noted that apparently Euripides introduced the wind, which serves no other plot function, ''solely'' in order to have an excuse to make Athena appear. In fact, Euripides is pretty notorious for this: he did it in ''Theatre/{{Alcestis}}'' and ''Theatre/{{Medea}}''. Creator/{{Aristotle}} called him on it in ''Literature/{{Poetics}}''. And Creator/{{Aristophanes}} made him a character in one of his plays who at one point enters the stage with a crane.
** Another big deus ex machina occurs in the original ''Iphigeneia''. You know that sacrifice everybody's been upset about and Iphigeneia finally accepts? The priests come down in the final scene and say that when they looked away Iphigeneia had been replaced with a pig. Not highlighted for spoilers since she obviously lives if there's a sequel.
** The archetypal DEM (by Euripides again) is at the end of ''Orestes''. Orestes and his sister have been condemned to death for murdering their mother (which Orestes was ordered to do by Apollo, since their mother killed their father, which she did because the father had killed their sister...) But anyway, the two of them and Orestes' best friend Pylades have escaped, taken Orestes' fiancée hostage, and are holed up in the palace ready to burn it all down around them... when all of a sudden Apollo pops in and calms everyone down, so everybody is friends and/or married. Compare with the other Orestes, by Creator/{{Aeschylus}}, the idealist of Greek theater. In his version (the play is called ''Theatre/{{Eumenides}}''), it is Athena and not Apollo who sets things right in the end, and she calls for a trial. She suggests that the matter should be resolved not by blind obedience to the ancient law, but by having the accused judged for his crime in a court of law. Essentially, she says that human beings have matured enough to dispense justice themselves, without relying on supernatural forces and beliefs, and to vote whether they should punish or absolve, in the spirit of fairness. Moreover, the law should err on the side of compassion: when the jury comes up with a split vote, Orestes is found innocent. So, although technically you still have an actor and a crane at the end, this is NOT a deus ex machina. The goddess appears, but for a reason. Indeed, she drives home the whole point of the play. Aeschylus made a social commentary about crime, punishment and justice, and the goddess is a legitimate storytelling device. While Euripides made an action flick, pushed himself into a corner with a ridiculously convoluted plot, and then had to resort to a deus ex machina, a god who simply barges in and announces that Orestes is innocent for no apparent reason. Happy ending, have a good night. (At the time, that was actually considered modern, since a tragedy's normal ending was a huge bodycount.)
* In ''Theatre/PokemonLive'', the original Mewtwo shows up and saves the day, using his telepathy and Ash's heart to give [=MechaMew2=] a Care Bear Stare. There was no way he could defeat Giovanni on his own, especially since Pikachu had already been knocked out.
* Parodied in P.D.Q. Bach's ''The Stoned Guest''. At the end of the opera, [[KillEmAll every character is killed or otherwise dies]]. Then, for literally ''no reason at all'' ([[ExecutiveMeddling other than the arbitrary decree of the composer's patron, who didn't like the original ending]]), they all spring back to life and sing about how it's a happy ending.
* Creator/{{Moliere}} tended to lean on this to wrap up many of his comedies. In ''Theatre/{{Tartuffe}}'' the protagonists are saved in the last act when a police officer shows up out of the blue with an order from the king arresting the villain. The conclusion of ''The School for Wives'' is so bizarrely complicated that we're still not quite sure what happened, but the gist is that the starcrossed lover's respective families show up to let them know that they had arranged their marriage years ahead of time (without either of them knowing it).
* Parodied in the [[Creator/BertoltBrecht Brecht]] play ''Theatre/TheThreepennyOpera'', where the playwright actually goes to the length of having his characters explain that the play really ends differently... but, for the sake of a happy ending, a royal official enters on horseback to make everything better. The play ends with a comment saying how unlike real life this is.
** There's an inversion of this trope in another Brecht play, ''The Good Person of Szechuan''. Just as things have got as bad as they can possibly get for the protagonist, Three Gods (who have been present on Earth since the opening scene, and in fact were responsible for the protagonist's predicament in the first place), pointedly do ''not'' step in to resolve matters, and instead mount a giant pink cloud and ascend into the heavens.
** Brecht was very fond of parodying - and thwarting - an audience's need for closure and happy endings, as it was part of his theatrical manifesto to leave an audience ''un''satisfied, and thus hopefully motivated to go out into the world and change things for the better.
* Creator/GilbertAndSullivan often used these (or very out-of-left-field [[TakeAThirdOption Third Options]] disguised as these) to resolve their plots. Which ones are straightforward Deus ex Machinas and which ones are parodies or subversions can be an interesting subject for debate.
** ''Theatre/HMSPinafore'' is certainly one of the more genuine examples; although Little Buttercup often hints that she has a dark secret, and there is a more subtle clue in [[spoiler: Ralph's erudite vocabulary]], nothing in the play could remotely help an audience think that [[spoiler: Ralph and the Captain being switched at birth]] is even plausible in the world of the play, let alone that [[ContrivedCoincidence Buttercup would have been involved]] plus on board at the right time to reveal it, etc., etc. But hey, look at that, it happens to solve both the A- and B-plots in one fell swoop! Cue the finale, it's time to go home!
** ''Theatre/ThePiratesOfPenzance'', on the other hand, is a definite parody. Not only have wacky plot elements been present from the beginning of the operetta, but there has been plenty of foreshadowing of Ruth's final revelation ([[spoiler:that the pirates are really noblemen]]); from the first line of the first song, in fact! (Examples:[[spoiler: they drink sherry instead of rum or grog, they hold fast to their code of honour even when it leads to their constant defeat in battle, and there is ''an entire song'' about how it's better to be a pirate king than a real one]]). In the same opera, the police deliberately try to invoke this. At the moment when they are most hopelessly defeated in battle, they... call on Queen Victoria: The mere mention of her name makes the pirates give up instantly out of loyalty to her.
* Creator/WilliamShakespeare was generally good at averting and subverting this. ''Theatre/MeasureForMeasure'' has an ending that probably seems like Deus Ex Machina to the characters, but the audience spent the entire play watching the Chessmaster set it up. ''Theatre/AMidsummerNightsDream'' ends amicably when the fairies step in and fix everything with magic, but it takes them three tries to get it right and in the meantime they screw everything up even worse. The ending of ''Theatre/TheWintersTale'' is either this or FridgeBrilliance, depending on how you read it (although it did [[ExitPursuedByABear name a trope]] that is usually a DEM). But the pastoral comedy ''Theatre/AsYouLikeIt'' is a straight example, with the father arriving out of the blue to put all conflicts to rest.
** In ''Theatre/TheComedyOfErrors'' an abbess we've never seen before shows up, and she's the long-lost wife of Egeon and mother of the Antipholuses, one of which had been living in the same town with her all this time and never knew.
** In Shakespeare's ''Theatre/{{Hamlet}}'', act IV, scene VI, [[spoiler: Hamlet is kidnapped by pirates on the way to England, who kindly return him to Denmark.]]
** In ''Theatre/TheMerchantOfVenice'', Portia produces a document at the end which reveals that [[spoiler: Antonio's ships didn't sink after all and he is still rich.]] It is never explained how she got this information or why she didn't reveal it before [[spoiler: Shylock lost everything he owned and Antonio ''nearly died.'']]

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

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

[[folder:Web Comics]]
* ''Webcomic/BobAndGeorge'', where rather often various "convenient plot devices" were thrown in (to the point that even the author of the series himself became a regular cast member).
* [[Webcomic/DinosaurComics T-Rex]] explains it in his inimitable style [[http://qwantz.com/archive/001354.html here]].
* In an apparently unintentional {{lampshade|Hanging}}d example, Miranda of ''Webcomic/DominicDeegan'' has taken to calling herself "Deus Ex Momina," being a rather jarring ParentExMachina in what is neither a sitcom nor starred by a teenager. WordOfGod states the joke was her terrible delivery of the joke rather than being one of the most MetaGuy moments the comic's ever had. There are other events where this happens, sometimes even being mentioned by the cast. "[[http://www.dominic-deegan.com/view.php?date=2004-03-01]]"
* The plot of ''Webcomic/ErrantStory'' is kicked off when Meji casts a spell to invoke a Deus Ex Machina so she can find a way to complete her senior project and graduate from wizard school. As a result, she accidentally discovers, in the school library, the only surviving copy of a book that contains some information that the elves were trying to keep secret. Oddly, despite the [[LampshadeHanging name of the trope being mentioned]], this is ''not'' a normal example of the literary trope, because it serves to drive the plot rather than resolve it.
* In ''Webcomic/GameDestroyers'', Ferahgo is a purposeful example of this, and Jipples has become a minor, though lazy, example of this as well.
* ''Webcomic/KevinAndKell'' has seen its fair share of these in its [[WebcomicsLongRunners two decades as a comic]]. One arc [[http://kevinandkell.com/2011/kk0608.html from June of 2011]] involving factional elections amongst rabbits comes to an end with a completely unexplained, contrived resolution that [[StatusQuoIsGod restores the status quo]], just in time for [[InvincibleHero the Dewclaw family to escape their latest conundrum.]] Made all the more jarring by their salvation in this situation spontaneously appearing and disappearing with no indication from where or why it came and left as it did. Even if [[http://kevinandkell.com/2011/kk0623.html the final strip]] is a hint to who saved the day, it's still never mentioned before or after.
* ''Webcomic/MagickChicks'': At the end of chapter 15, [[spoiler: [[EvilRedhead Cerise]]]] mass teleported the student council to their {{uncertain doom}} and she was the only one who knew their location. You'd think it would've paved the way for a RescueArc, or that she'd be forced undo the spell and return them. Nope. Near the end of chapter 18, the wand became [[PlotDevice an all-purpose problem solver]] by enabling Mel to sense they were alive, [[spoiler: [[http://www.magickchicks.com/strips-mc/she_was_alive instantly whisked her to where they were, and back]]]], in less than a minute.
* ''Webcomic/TheOrderOfTheStick'': The [=MitD=] plays this role in [[http://www.giantitp.com/comics/oots0661.html this comic]]. While the Monster in the Darkness is a mystery to everyone except Rich Berlew; this new ability introduced comes right out of nowhere and at the most convenient of times for our heroes. The fact that it also reunites them back with their friends does not help. [[http://www.giantitp.com/comics/oots0441.html This comic]] also features something that is hard to accept at face value (no air turbulence and coincidence). It's deliberately played off under RuleOfFunny so it is excusable, but still tastes like a WriterCopOut. Receives {{lampshad|eHanging}}ing [[http://www.giantitp.com/comics/oots0504.html here]]. Also, while it's not quite an example (there are a few hints), the comic lampshades how close it is to this when [[spoiler:Julio Scoundrel arrives just in time to save the Order of the Stick from Elan's father in his flying airship. The name of his airship? ''The Machina''.]]
* LampshadeHanging: In ''Webcomic/QuestionableContent'' the cast are trapped in an alley by a crazed KnightTemplar / AntiHero and her robot {{Sidekick}} until they are saved at the last minute by their own [[RobotBuddy robot sidekicks]] under the battle cry "Deus Ex Machina!". QC, one should note, is set in a slightly-warped version of the ''real'' world, somewhere between MundaneFantastic and a [[SpeculativeFiction sci-fi]] or {{superhero}} world.
* Justified: ''Webcomic/SluggyFreelance'' features a literal Dea Ex Machina who is not a literary Deus Ex Machina in the "[[http://www.sluggy.com/daily.php?date=040519 That Which Redeems]]" story arc. The goddess of good has been trapped in the Demon King's refrigerator since the conquest of her world, but as the story had been told within the comic years previously, her appearance was widely predicted by the readers. So when she's freed from the fridge and sets things right, no one's really surprised.
** Also in that unsealing the goddess was a Torg's deliberate goal that he struggled and sacrificed for, whereas a Deus Ex Machina is by definition easy and out of nowhere. This is really more SealedGoodInACan (though if it were a can instead of a leaky ziplock, we'd be short several plotlines).
** The "Holiday Wars" arc plays with it and provides a DoubleSubversion. We learn that there exist three magic "Deus ex ova", Latin for "God from the eggs", magic eggs created by the Greek gods that will hit the ResetButton if broken, and that Bun-Bun's main antagonist SantaClaus has one of them. Finally, when Santa is left with no other options, he tries to use it, but [[spoiler: Bun-Bun, being the Easter Bunny, has hidden the egg]]. Later, [[spoiler: Bun-Bun himself is forced to use it to save his own life, magically bringing all of his enemies back to life and defeating him, but leaving him alive.]]
** The end of 'Oceans Unmoving' literally has a god from out of nowhere, or at least his blood relative. While the sudden appearance of the brother of a Time God living in the basement of a timeless dimension is thematically consistent, he really seemed to appear just in time to wrap up the storyline quicker. Bonus points for wrapping the continuity to the beginning of the series though, and explaining Bun-bun's appearance without revealing any mysteries about his past. This is lampshaded, since Uncle Time automatically assumes that Bun-Bun [[RiddleMeThis solved his riddle]], which led him there. Bun-Bun has never even heard of the riddle or Uncle Time, despite all of the lore and myths that the story invokes.
* ''Webcomic/SchlockMercenary'' on several occasions. Also lampshaded [[http://www.schlockmercenary.com/d/20050319.html here]].
** The Petey-focused extra story in the printed version of book 7 is actually called "Deus ex Nausea", as scenario after scenario is resolved by sudden Fleetmind interference. He's actually trying to subtly kill the literary device in several cultures in an attempt to make them more self-reliant, which gets awkward when he's simultaneously acting as one.

[[folder:Web Original]]
* [[http://www.wowwiki.com/Chronicle_of_the_Annoying_Quest Chronicle Of The Annoying Quest]] features a character ''named'' "Dues X. Machina" (Pronounced "doose"). The name seems to be an ironic joke, however, as he doesn't actually do anything plot-related in his first appearance (though he does provide another excuse for [[HilarityEnsues hilarity to ensue...]])
* The 7th ''Literature/ChronoHustle'' story, which is in fact title Deus Ex Machina, involves a situation where Jack Masterson is about to be raped by Aphrodite. He has no way out of the situation when suddenly [[spoiler:Hermes]], who had not been so much as mentioned up to that point, shows up. He [[spoiler:doesn't actually save the day, but does provide enough of a distraction to give the rest of the main cast time to show up.]]
* In ''Roleplay/TheGamersAlliance'', when Leon is about to die in battle, a black wolf appears all of a sudden and saves his life. It later turns out that the wolf was in fact [[AntiVillain Kagetsu I]] whom Leon had unknowingly freed earlier. [[{{Pun}} Technically Kagetsu was only a half-god, though]].
* When [[Literature/TheLayOfPaulTwister Paul Twister]] is right about to get caught by a guard, an angelic warrior whose life he had saved at the beginning of the story shows up to conveniently provide a distraction, just long enough for him to get away. [[GenreSavvy Paul is a bit freaked out by this, since it seems to have come out of nowhere]] and required knowledge that she shouldn't have had, and he figures that [[ThisIsGonnaSuck whatever he's caught up in is probably about to get worse.]]
--> Things like that just didn't happen to me, suddenly being bailed out by an unexpected ally, just seconds after being caught flat-footed. And she was a Celestial, to boot. [[LampshadeHanging Seriously, all that was missing was the ''machina''!]]
* Averted during the course of [[WebVideo/TheNostalgiaChick The Dark Nella Saga]] with the jar of mayonnaise. While it does allow for teleportation [[spoiler:and resurrection]] it was shown being injected with "a plot device" by Lord MacGuffin early on in the saga. The only remaining question is how [[MadScientist Dr.]] [[HotScientist Tease]] got the jar in the first place...
* ''WebVideo/SomeJerkWithACamera'': After accidentally erasing his own birth at the very end of his "It's a Small World" review, Jerk is saved by a dimensional figure called The All-Being, who transports him to an alternate universe that's exactly the same as his old own.
* {{Lampshade|Hanging}}d in [[http://onering.legendaryfrog.com/movies_or2_w.php The One Ring to Rule Them All 2]]. Frodo and Sam escape their lava trap with no other explanation than "plot device, Mr. Frodo, plot device".
* PlayedForLaughs in Website/TheOnion Sports Dome reporting a collapse of the Staples Center had brought an early end to a basketball game between the Los Angeles Clippers and the Phoenix Suns where the home team Clippers were on the losing end of a CurbStompBattle.
* Critics of the ending to ''Roleplay/SurvivalOfTheFittest'' v1 tend to claim that the only reason that Adam Dodd won was a series of these. Others who believe that the alternate universe "Afterlife" RP signifies the existence of the supernatural in SOTF claim that the spirits of [[TrueCompanions his dead friends]] may have been [[ThePowerOfFriendship protecting him]].
* Averted in VGHS, season 2: The Law [[spoiler:Is saved from Shane's men by Robot ShotBot. It is a Deus Ex Machina even more considering that he is saved by a machine, but we must consider that ShotBot's intervention was foretold in the beginning of the episode, and that his presence really is useful for the next events: ShotBot stays on track and makes the narration progress.]]

[[folder:Real Life]]
* This happened ''twice'' to Friedrich the Great, King of Prussia. In the same war. Both were called the Miracle of the House of Brandenburg. The first consisted of his foes suddenly turning back from assaulting his capital after he had been dealt an uncharacteristically crushing defeat (they were low on supplies and they feared they wouldn't be able to hold Berlin), the second, and more widely known one, involved the Tsarina, formerly his most implacable enemy, suddenly dying, giving way to the Prussophile Peter, who immediately made peace. Two centuries later, this led to [[UsefulNotes/AdolfHitler a very different German leader]] to hold out hope for a similarly unexpected stroke of luck at the end of his own war, but the gods wisely didn't smile on that bastard.
* The "Protestant Wind" is a name used for two extremely unlikely yet valid incidents. One is the storm which wrecked the Spanish Armada in 1588, saving England from a Spanish invasion (Spain being a Catholic country, hence "Protestant Wind"). The other is the bizarre wind patterns that allowed William III of Orange to ''successfully'' invade England and depose King James II in the "Glorious Revolution" of 1688. (James II was a Catholic, which his subjects did not like, and William was a Protestant. Again, "Protestant Wind".)
** And happened ''again'' in the far more obscure Spanish invasion of [[http://en.wikipedia.org/wiki/Battle_of_Glen_Shiel#Alberoni_plan 1719]].
** Inverted (in that France is considered Catholic): [[http://www.cracked.com/article_18894_6-real-historic-battles-decided-by-divine-intervention_p2.html?wa_user1=5&wa_user2=History&wa_user3=article&wa_user4=recommended Joan of Arc]] was trying to gain entry into Jean de Dunois's war counsels, but Dunois blew her off because a wind "which had absolutely prevented the ships in which were the food supplies for the city of Orleans from coming upriver." But then in that moment "changed and became favorable. From that moment I had good hope in her, more than ever before." Not only did the Siege of Orleans end up being considered Joan of Arc's greatest victory, Dunois thereafter became one of her biggest fans.
* The ''shinpu'' (in English, "Divine Wind", also known as "kamikaze") were a set of typhoons in the years 1274 and 1281 which prevented Mongol invasions of Japan.
** Note: Typhoons in that area only happen once in a thousand years.
** The Japanese Emperor competence and Mongol incompetence deserve a lot of credit for this for more mundane reasons than conveniently-timed Divine Intervention. After the Mongol's first invasion, the Emperor ordered walls built along the beaches in all suitable landing places so locals could hold off invaders long enough for samurai defenders to be deployed. The Mongols did not understand the difference between seaworthy ships and riverboats and commandeered many riverboats for their sea invasion rather than pay the expense of building a proper invasion fleet. When the Mongols arrived, they sailed around for months in mostly non-seagoing ships looking for a landing place. Sooner or later, bad weather would have sunk most of the fleet. River boats don't do well in the open ocean. The Emperor used the storms that sank the Mongols to promote the idea that Divine Mandate said that he and he alone should rule Japan.
* [[http://www.cracked.com/article_18894_6-real-historic-battles-decided-by-divine-intervention.html Deus Ex Machina]] basically gave America the win for quite a few battles in some pretty important wars. America's intervention with a million man army in World War One, after 3 and half years of German victories counts as a Deus ex Machina from a European political perspective. From a tactical and strategical standpoint however, the DeusExMachina effect was pretty limited.
* The infamous [[http://en.wikipedia.org/wiki/Snowplow_Game "Snowplow Game"]] is an example for the New England Patriots (as for the Miami Dolphins, it's DiabolusExMachina).