Another way of saying is "stars were aligned".yes and no .. job requirement match and timing was right ..
But you need to be actively looking and have developed yourself well in order to be selected so is also your effort.
Same has happened to me on several occasions but I would not have got the opportunity if I wasn't looking and developing my skills and qualifications.
In some cases I took on the role as the secondary person for that task and then the primary decided to leave and I got promoted. So also staying power is important.

