Philadelphia had looked set to suffer a fourth successive defeat after trailing 17-3 at half-time on the back of two touchdown passes from Giants quarterback Eli Manning to rookie receiver Darius Slayton.
But the Eagles rallied and the impressive Boston Scott reduced the deficit with a close-range dash into the end zone before Carson Wentz connected with Ertz in the final two minutes to level the scores up at 17-17 and send the game to overtime.
Wentz and Ertz then combined again in the extra period when the tight end escaped the attentions of the Giants defence to claim another two-yard catch and secure victory for the hosts.
Philadelphia's win sees close them close the gap to NFC East leaders the Dallas Cowboys, with both teams now having 6-7 records.
The Eagles face the Cowboys on December 23 before a return game against the Giants (2-11) a week later.