Suspect Luis Hernandez is escorted out of a police station after being arrested for beating an elderly woman.John Roca

A home invader forced his way into a 70-year-old woman’s Brooklyn apartment, where he slashed her with glass, pinned her to the ground and had to be tasered by cops before he would stop, police sources said Sunday.

Suspect Luis Hernandez knocked at the door of the elderly victim’s Bay Ridge apartment at about 10:10 p.m. Saturday, after first prowling the dimly-lit halls, knocking at other doors.

At one point he had been seen on surveillance footage entering the building while apparently arguing with a red-haired woman, sporting a red cap.

He later knocked on the door of a male resident, who told The Post that he had heard some kind of dispute outside before he looked through his peephole and seeing Hernandez, who was “sweating profusely,” staring back at him and asking him to open the door and “help” him.

Hernandez allegedly broke down the woman’s door and attacked her with a vase.John Roca

The neighbor refused, and instead called the cops.

Before the officers could arrive, however, Hernandez went to the door of his female victim and knocked.

Unaware of who was calling, the woman opened her door to him thinking it was a neighbor calling — and Hernandez allegedly rushed inside.

The 42-year-old fiend first struck the victim in the head with a vase, before smashing her in the face with a mirror and slicing into her torso with shards of glass, sources said.

When officers arrived on the scene they found Hernandez on top of the woman— continuing to struggle despite the cop’s presence.

The officers had to hit him with a taser when he violently began resisting arrest to bring him under control, sources said.

The attack left residents of the Ovington Avenue building worried about their safety.

“We need more security and police around the area,” the neighbor fumed Sunday when asked about the incident. “He need to stop just letting random people into the building.”

Hernandez, of Queens, was charged with multiple counts of assault and burglary, according to police. His record includes three prior sealed arrests, authorities said.

The woman was taken to Lutheran Medical Center in stable condition. Hernandez was taken to the same hospital for observation, cops said.