幸亏 (xìngkuī), 幸好 (xìnghǎo), and 好在 (hǎozài) mean "fortunately" or "luckily". They can be used to express that something has happened by chance, and has thereby enabled you to avoid some difficulty. It is often used together with 不然.
Structure with 幸亏
It's as simple is adding 幸亏 or 幸好 before the thing that makes you feel lucky. The pattern is:
Examples
Xìnɡ kuī wǒ men zǒu dé zǎo.
幸亏 我们 走 得 早。
幸亏 我们 走 得 早。
Luckily, we went early.
Structure with 还好
还好+accidental reasons
“还好” can also mean “fortunately”, but is more colloquial than 幸好, 幸亏 or 多亏.
Examples
Hái hǎo wǒ méi tīnɡ tā de , bù rán wǒ jiù dǎo méi le .
还好 我 没 听 他的,不然 我 就 倒霉 了。
还好 我 没 听 他的,不然 我 就 倒霉 了。
It's a good thing I didn't hear him. That would have been unlucky.