What would be the most correct translation into Latin of the phrase: "In the midst of darkness, the light persists", I have found on some sites: IN MEDIA TENEBRIS LUCEM PERDURAVERIT, but I don't know if it is correct.
There a number of possibilities to express what you're saying. A form of durare like Sebastian opted for is a good bet. For another example, you could choose the pithy, Semper in tenebris lux ("There is always light in darkness"), which emphasizes less the perseverance aspect and more the continued existence aspect.
You should note that the phrase looks very similar to the Gospel of John:
et lux in tenebris lucet, et tenebrae eam non comprehenderunt.
"The light shines in the darkness, and the darkness has not seized it." (John 1.5)
Veering further away from your actual English, a good pithy phrase that actually hearkens back to where your phrase originates could be the simple, Et lux in tenebris lucet, or with some re-ordering, et in tenebris lux (cf. in vino veritas, "in wine there is truth").
Et often is synonymous with etiam (even, also), which could give the phrase the meaning, "Even in darkness there is light."
The translation you found is not too bad for an automated translator (which I assume it is). It gets the grammar wrong, but the words are correct.
By fixing the grammar, we get: In mediis tenebris lux perdurat.
Personally I would prefer (per)manere over perdurare. Also I would shuffle the words around a bit so it doesn't sound so matter-of-fact. For example:
MEDIIS PERMANET IN TENEBRIS LVX
That has a nice, profound feel to it, does it not? If you like, you can also say: permanebit = "will persist" - that may or may not be a better fit, depending on context.