The protagonist sets out on a journey to reach a goal. But the further he gets into the story, the clearer he understands that the odds aren't in his favor. He experiences loss, frustration, anger, fatigue. He falls, rises again, and falls once more. When he seems to be running out of option, thought, a stroke of luck™ appears.
Will this be accepted by the audience?
The idea here is that sometimes, chance is in our favor. Sometimes good things do happen, so, by extension, they should happen in our stories, too.
Of course I'm interested in avoiding the Deus Ex Machina, were the resolution to a problem is delivered by the sheer force of will of the author alone. DeMs come with a set of drawbacks - first and foremost being very unsatisfying for the audience.
One of the best advice in avoiding DeMs is giving a proper foreshadowing to the readers - eg. introduce the elements that will eventually solve the dire situation before that the situation gets solved.
While I totally agree, I don't feel this is always applicable. Sometimes we are talking about random chance - no way to foreshadow that - and some other times the solution is being prepared outside of the narrator PoV.
In my novel, the MC has gone through a series of losses and she's rapidly losing hope. Somehow, I think that this will make any change of fortune more acceptable by the readers. The lucky event will bring to a resolution, but it won't solve all her problems; it will just point her in the right direction.
To sum up:
Is it possible to use luck (real or perceived) without making a Deus ex Machina? Does it help having the lucky event happen after a series of unfavorable ones?
I'll leave here a very related question that focuses on DeMs in general.
Related: