It seems many of the wise old owls have forsaken these discussions. Not to presume, but I can offer some observations that I believe are relevant.
The Spanish language generally follows a subject-verb-object (SVO) sentence structure. Unlike English, however, it is quite flexible with word order. In part, because it doesn't need to rely upon word order to establish subject and object. These are typically made clear from verb conjugation and the unstressed object pronouns (lo, la, le, los, etc.) that complement the explicit objects. For this reason, the typical SVO structure can be altered to verb-subject or verb-subject-object without completely confusing things.
OK. So, it's grammatically legal. How do we know when to switch from SVO to VS? Frankly, you won't find rules to tell you which word order to use. There are some considerations that can inform your choice:
1 . Using VS to represent the passive voice -
The thief was arrested - Arrestaron el ladrón (this actually converts the subject (the thief) to an object and omits a subject altogether)
2 . Using VS to place the emphasis on the verb -
Quiet! The children are sleeping - ¡Callen! Duermen los niños
3 . Using VS with intransitive verbs of existence or happenings -
A lot of opinions exist concerning the afterlife - Existen muchas opiniones de la otra vida
The sentence Ocurrió un ataque falls into the last category listed above and is a very common way to express the idea.