For those who are unaware, <i>deus ex machina</i> literally means 'gods from the machinery' and comes from theatres in Ancient Greece where plays tended to end by the gods (and presumably goddesses) appearing and sorting everything out.by divine word. This allowed the playwright free reign to create difficult situations and convoluted plots without needing to worry about making it all work out logically.
These days tastes are a little more sophisticated (and certainly more agnostic) and using occult forces to solve all the plot points with a wave of their mighty and ineffable fingers is likely to be seen as a bit of a cop out, not to mention laziness on behalf of the writer.
But there are writers who still managed to get away with such things to some degree or another. This needs to be handled with care for the above reasons and it seems to me that a lot of time it would have been easier to arrange a more conventional ending.
The classic <i>deus ex machina</i> endings are those provided by arch teller of tall tales, Robert Rankin. He is well aware of the history and uses them in a somewhat tongue in cheek way, conjuring up old gods to literally inhabit a piece of machinery. This is particularly true and effective in the <i>Armageddon</i> trilogy where (apart from having Elvis Presley as a action hero and a time travelling sprout) the endings come to a head with the hero Rex Mundi having to overcome some possessed computer bent on world destruction.
A rather more subtle but very successful approach is taken by Stephen Hunt, author of a series of novels set in a strangely sub-Victorian far future country called Jackals. Here 19th century technology and ancient gods of the land rub shoulders and as a result the endings are a blend of both, the gods not being able to resist saving the world it seems. The best (and I think very well handled) example is in <i>Secrets of the Fire Sea</i> where in a very literal way everything is sorted out by a god appearing from a machine. But this is no cop out - the whole ending has been set up throughout the book.
We may not rely on <i>deus ex machina</i> endings for everything any more but they are still around if you know where to find them. Embrace them as being both different from the norm and throwback to a long gone age.