Eucatastrophe

A eucatastrophe is a sudden turn of events in a story which ensures that the protagonist does not meet some terrible, impending, and plausible and probable doom.

[4] Eucatastrophe in fiction has been labelled by some as a form of deus ex machina, due to both sharing an impossible problem being suddenly resolved.

[5][6] However, differences between the two have been noted, such as eucatastrophe's inherent connection to an optimistic view on the unfolding of events in the narrative of the world.

Though victory seems assured for Sauron, the One Ring is permanently destroyed as a result of Gollum's waylaying of Frodo at Mount Doom.

While their role has been described as that of a deus ex machina,[10] Tolkien described Bilbo's "eucatastrophic emotion" at the eagles' appearance in The Hobbit as one of the key moments of the book.

In a classic use of eucatastrophe, the prince arrives to break the spell that has kept Sleeping Beauty and her kingdom asleep for 100 years. 1897 illustration by Gustave Doré
The climax of The Lord of the Rings , as portrayed by Ted Nasmith