Yes, both alternatives are correct and both are commonly used. When we use "it" or "there" as a subject it is called an expletive. " However, in formal English all sentences must have a subject except commands where the subject of "you" is understood.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.