Deus ex machina is Latin for "god from the machine" and is a calque from the Greek "από μηχανής θεός", "apo mikhanis theos". It originated with Greek and Roman theater, when stage machinery would lower a god or gods onstage to resolve a hopeless situation: thus god comes from the machine. The phrase deus ex machina has been extended to refer to any resolution to a story which does not pay due regard to the story's internal logic and is so unlikely it challenges suspension of disbelief, and presumably allows the author to end it in the way he or she wanted.

The Greek tragedian Euripides was notorious for using this plot device. A few more recent examples, where it isn't literally a god-like being, but is a similar sudden resolution of plot, are in the films The Joyless Street and Pandora's Box by G.W. Pabst. In Pandora's Box, the movie is ended when for no apparent reason the main character is murdered by Jack the Ripper. Stephen King's novel The Stand would arguably be another example: a minor character who has gone insane returns with an atomic bomb, which is set off by an electric charge taking the shape of a hand, destroying Las Vegas; characters in Boulder believe the charge to have been the "Hand of God." Monty Python and the Holy Grail is another example; however, the ending — in which the movie comes to a sudden halt when the entire cast is arrested — is intentionally preposterous in this case. In the Peter Straub/Stephen King novel The Talisman, one of the chracters is said to be driving a Deus ex machina.

The pronunciation is a problem in English. Traditional ways of saying Latin would have it something like DEE-us ex MAK-in-a, more modern ways of saying Latin would give perhaps DAY-oos ex MAH-kin-ah, but many people naturally bring in the modern English m'SHEEN, resulting in a mixed pronunciation.

See also: plot