Baby woke up from sleep screaming?

My almost 3 month old was sleeping in my arms. And randomly he woke up with his arms jumping and then his eyes widened and he screamed so loud. I got up so quick and held him to my chest and he stopped. What can be wrong?? Did he have a nightmare or?? I thought babies that age don’t have nightmares.