This phrase, pronounced 'day-us ex mack-eena' and meaning literally 'god from the machine', describes a plot device in books, plays and movies where a tangled plot is suddenly sorted out by the appearance of a godlike person with extraordinary powers. This can be as simple as the US cavalry appearing over the hill and arresting all the baddies.
The Deus Ex Machina originated in the Greek plays of the 5th Century BC, where the convoluted plot would often be sorted out by the appearance of a god who, with his magic powers, could set everything to rights. As befitted his godly status, the deity usually made his appearance floating onto the stage. A statue of the god was hoisted up using a special crane while an actor spoke the god's words from behind stage, giving rise to the phrase 'god from the machine'1.
The phrase came to be used for any sort of improbable and miraculous escape, where someone previously unrelated to the plot would appear and everything would be put to rights.
The Easy Cop-out
In modern times, the Deus Ex Machina as a plot device is generally disapproved of. It is seen as a cop-out. An example of this was the British science fiction TV series, Blake's Seven. In many of the episodes, the main characters were extricated from trouble by being zapped off the stage by the spaceship's teleporter. Here, a potentially interesting plot resolution was bypassed in favour of a piece of magic technology. Instead of good triumphing over evil, or clever rebels defeating stupid authority, all problems could be solved by pressing the teleport button.
Avoiding the Deus Ex Machina
Many movies and books will go a long way to prevent characters having too much in the line of godlike powers. Two good examples are Doctor Who and The Lord of the Rings.
This madcap Time Lord has a transport device, the TARDIS, which is capable of moving through both time and space. This would give the Doctor virtually unlimited power and reduce the plot to the level of Blake's Seven. To prevent this, the Doctor's TARDIS is unreliable or just plain broke. When he can get it to work at all, it brings him to a random destination. This is a convenient way of getting to the start of a new adventure, but it can't be used to sort out the problems within an adventure.
Lord of the Rings
Frodo possesses the ring of the Dark Lord, which can turn the wearer invisible. But he is unable to use it, because the Dark Lord would be aware of his presence. Gandalf is a powerful wizard, with abilities barely hinted at, but he never uses his magic, except for a little bit of fire-raising. The problems of tyranny and world domination must be solved by the more human abilities of bravery and determination.
A Good Modern Example
Nevertheless, the sudden revelation of the Deus Ex Machina can be used well. A good example in modern movies is Shakespeare in Love. Lady Viola is in serious trouble because she has acted the part of Juliet on stage, but the stage is forbidden to females. The whole theatre is to be closed and Master Shakespeare will lose his job. But one member of the audience reveals herself to be Queen Elizabeth, who has absolute power and can change the rules any way she likes. The appearance of the Queen is not entirely unexpected, as she had been in the story earlier, but her godlike powers certainly have all the hallmarks of this plot device.
Woody Allen's movie Mighty Aphrodite mixes a modern comedy with a classical Greek play, to great effect. In the epilogue, the eponymous heroine finally meets the man of her dreams when his helicopter is forced to land on the road in front of her car. Allen wryly remarks to the camera, 'Talk about a Deus Ex Machina!'