adverb
Literary or old-fashioned adverb meaning 'as luck would have it' or 'fortunately'. In modern Japanese, 運良く or 幸い are more common.
あたかもよし、雨が上がった。
Fortunately, the rain stopped.
あたかもよし、彼が通りかかった。
Luckily, he happened to pass by.
Compound of 恰も (atakamo, 'just as if') and 好し (yoshi, classical form of 良い 'good'). The exact historical derivation is uncertain, but the phrase literally suggests 'as if it were good' and came to mean 'fortunately'.