幸亏 (xìngkuī), 幸好 (xìnghǎo), and 还好 (háihǎo) 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 or bad luck. It is often followed with 不然 (which precedes the bad thing that could have happened).
Expressing Luck with 幸亏 and 幸好
It's as simple is adding 幸亏 or 幸好 before the thing that makes you feel lucky.
幸亏 / 幸好 + [lucky incident]
And if you want to add in 不然 for an "otherwise… " explanation, use this structure:
幸亏 / 幸好 + [lucky incident]， 不然 + [bad thing that could have happened]
xìngkuī wǒmen zǒu dé zǎo.
Luckily, we left early.
xìngkuī nǐ zài, bùrán wǒ bù zhīdào gāi zhǎo shuí.
Fortunately you're here, otherwise I don't know who I could turn to.
xìnghǎo jīntiān dài sǎnle, bùrán yào lín shīle.
It's a good thing I brought the umbrella. Otherwise, I would have gotten soaked.
Expressing Luck with 还好
"还好" can also mean "fortunately," but is more colloquial than 幸好 or 幸亏.
还好 + [lucky incident]
And if you want to add "不然" with an "otherwise…" explanation, use this structure:
还好 + [lucky incident], 不然 + [bad thing that could have happened]
hái hǎo wǒ méi tīng tā de, bùrán wǒ jiù dǎoméi le.
It's a good thing I didn't listen to him. Otherwise I would have been in for it.
hái hǎo wǒ bǎocún le, bùrán wénjiàn dōu diū le.
Luckily I saved it, otherwise I would have lost all of the documents.
Translated from: allsetlearning
Please visit Chinlingo for Chinese learning.