Use this expression to talk about an event that happened suddenly after another event.
The moment I stepped out on the court, I knew that I didn't have a chance.
The moment I stepped outside, a bird flew right by and shat right on my shoulder!
But this expression is most often used to talk about what happens when you look at something:
The moment I looked at Sam, I busted out laughing.