An NYPD tow-truck driver died Monday night after he suffered a heart attack while behind the wheel and crashed into a tree in Brooklyn, authorities said.

The driver, identified as Anthony Edgehill, was driving his truck just before 7 p.m. on Flatbush Avenue near Avenue R in Marine Park when he had the heart attack, cops said.

He then lost control of the tow truck and smashed into a tree, authorities said.

Medics rushed him to Mount Sinai Hospital in Brooklyn in serious condition, police said.

Edgehill died at the hospital soon after, his union representative, Marvin Robbins, said.