An elderly motorist hit the gas, accidentally backed his car over a grandmother and struck two tots in Brooklyn yesterday — pinning the woman and splitting a baby carriage in half, witnesses and cops said.

Stunned bystanders rushed over to lift the old man’s car off 51-year-old Elizabeth Castillo after the 1 p.m. accident near Humboldt and Moore streets in Williamsburg, witnesses said.

“She was all bloody,’’ said witness Wilfredo Soto, 44.

The woman suffered broken ribs and other injuries but is expected to survive, said her daughter Camille.

The children — Castillo’s 3-year-old grandson and a 17-month-old girl — suffered non-life-threatening injuries. The baby girl, whose mother was pushing her in a stroller, had a broken arm and an eye injury. The boy, who was walking with his grandma, suffered facial cuts.

The 77-year-old driver had been backing up his Hyundai XG350 when he first slammed into a parked car on Moore Street, slightly injuring 75-year-old Nilda Rosario, who was sitting in the driver’s seat.

“I have pain in my neck. Thank God I was wearing the seat belt,” Rosario said.

The motorist then apparently hit the gas. His car continued backward on Moore Street and rode up onto a sidewalk, where Castillo was with grandson Tyreese Owens, the other woman and her toddler daughter, Tashia Green, said Camille Castillo.

Elizabeth Castillo became trapped beneath the Hyundai, and it took seven people to lift the car off her, witnesses said.

“She was passed out,” Soto said. “The boy was screaming.”

Castillo and the two children were rushed to Bellevue Hospital, where they were in stable condition last night. Castillo was conscious but unable to speak.