A New Jersey nanny had broken up with her boyfriend just hours before he fatally stabbed her boss — and then chased down her down a street in leafy Maplewood and killed her, authorities said Monday.

Suspect Joseph Porter, who is accused of knifing to death gal-pal au pair Karen Bermudez-Rodriguez and her employer, Manhattan comedy-club boss David Kimowitz, was later nabbed at Newark Liberty International Airport trying to flee to Cancun, Mexico, according to court papers.

The brooding beau, 27, of Elizabeth, NJ, had apparently snapped after receiving multiple texts from Bermudez-Rodriguez, 26, between 1:30 and 2 a.m. Saturday insisting they were through, court papers show.

He had recently been spying on her from outside Kimowitz’s home, where she lived with the club owner and his wife while taking care of their two young daughters, neighbors said.

In one of the pre-dawn texts, the au pair demanded back her keys to the Kimowitzes’ home, the papers said.

Porter “texted back that he was upset’’ by her messages, the documents said — and soon, he allegedly did something about it.

He told cops that sometime that morning, before 6 a.m., he used the keys to sneak into the family’s home in the quiet, high-end suburb in Essex County and walked to the second-floor bedroom with a knife and stabbed Kimowitz to death, the court documents show.

A female voice could be heard from inside the home screaming, “Oh, my God! Oh, my God! Oh, my God!’’ a neighbor said.

David’s wife and two little girls were away for the weekend at the time.

Porter then tied Bermudez-Rodriguez’s hands with tape, but she was able to escape the home and run down the road, according to the records.

Bermudez-Rodriguez got a few hundred yards before Porter caught up with her and stabbed her with a different knife, the documents said.

One or both of his victims presumably put up a valiant although tragically futile fight — the papers say he had “visible scratches on his arms and neck’’ when police collared him.

A neighbor heard fighting outside and saw Porter attacking the au pair and called police around 6 a.m., cops said.

Surveillance video from a nearby home caught Porter on tape chasing the nanny. She died within the hour at a local hospital.

Kimowitz, who ran the club The Stand near Union Square, was dead at the scene, the knife used to kill him found next to his body, according to the documents.

Porter tried to flee the country later that morning but was intercepted by cops, the records say. A law-enforcement source told The Post that Porter’s mom had given him $800 for the plane ticket, although it’s unclear if she knew he was trying to flee after the crime.