You were right to sleep with a nightlight, according to the first trailer for horror movie “Lights Out.”

Based on David F. Sandberg’s two-minute short film of the same name, which gained some viral fame in 2013, “Lights Out” follows Rebecca (Teresa Palmer) and her younger brother Martin (“Annabelle’s” Gabriel Bateman) as they’re tormented by a spirit that draws its power from darkness.

With every flicker of the light, the figure of a woman draws closer as its victims struggle to keep the light around to draw it away. After some investigating, the two find out that the poltergeist is tied to an event in their mother’s past, and feeds on fear.

Sanberg directs from a script by Eric Heisserer. Alexander DiPersia, Billy Burke and Maria Bello also star.

The trailer’s unique scares should be little surprise, given that James Wan, the director behind horror hits “The Conjuring” and “Insidious,” is one of the producers. Heisserer also produces, along with Lawrence Grey. Dave Neustadter, Walter Hamada, Michael Clear, Richard Brener, Ben Everard and Jack Murray executive produce.

The trailer debuted at New Line’s WonderCon panel on Saturday, along with a new trailer for Wan’s “The Conjuring 2.” “Lights Out” hits theaters July 22.