Foles, who was 24 of 38 for 237, took over as the Eagles starting quarterback after they lost Carson Wentz last week to a season-ending knee injury. Foles helped his team clinch a first-round bye in the playoffs.
Meanwhile, Giants quarterback Eli Manning finished 35 of 54 for 427 yards with three touchdowns and one interception.
The Giants, who haven't scored more than 20 points in a game since Nov. 12 against the San Francisco 49ers when they recorded 21 points, scored touchdowns on their first three drives of the game. Those included a 1-yard run by Orleans Darkwa, a 13-yard pass from Manning to wide receiver Tavarres King and a 67-yard catch by wide receiver Sterling Shepard from Manning.
Giants kicker Aldrick Rosas' extra-point attempt on the Giants' opening-drive touchdown was blocked by Eagles rookie defensive end Derek Barnett.
The Eagles got on the board with a 3-yard touchdown pass from Foles to wide receiver Alshon Jeffery in the first quarter.
Philadelphia then went on a scoring tear with 14 unanswered points in the second quarter thanks to a pair of touchdown passes to their tight ends following two Giants miscues that led to the Eagles' scoring drives from the red zone.
The first, a 10-yard pass from Foles to Zach Ertz, was set up after Eagles cornerback Ronald Darby picked off Manning's pass intended for wide receiver Roger Lewis and returned it 37 yards to give his offense the ball on the Giants' 20-yard line.
The second, a 13-yard catch by Trey Burton from Foles, came after the Eagles' Kamu Grugier-Hill blocked Brad Wing's punt deep in Giants' territory.
Rosas gave the Giants a 23-21 lead at the half on his 28-yard field goal, but the Eagles took it back with 10 unanswered points starting with kicker Jake Elliott's 28-yard field goal and wide receiver Nelson Agholor's 10-yard touchdown catch.
The Giants took advantage of an Eagles neutral-zone infraction that gave them a fresh set of downs, which allowed Manning to eventually connect with King on a 57-yard touchdown reception. The two-point attempt failed.
The Giants also couldn't convert on a 48-yard Rosas field-goal attempt that was blocked by Malcolm Jenkins, which left the score 31-29 until Elliot's 20-yard field goal increased the Eagles' lead to 34-29.
NOTES: The Eagles have won four of their last five road games against the Giants and have swept the season series against their NFC East foes in three of the last four seasons. ... Giants QB Eli Manning set a career high for passing yards in the first half of a game (252). ... Giants S Landon Collins was ruled out with an ankle he injured midway through the second quarter. ... Giants LB B.J. Goodson aggravated an ankle injury in the third quarter. ... Giants WR Tavarres King sustained a concussion on his 57-yard touchdown reception. ... Eagles CB Patrick Robinson suffered a head injury and was being evaluated for a concussion. He didn't return. ... Eagles TE Trey Burton had to come out of the game in the fourth quarter due to cramping. ... The Eagles (12-2) will host the Oakland Raiders on Dec. 25. The Giants (2-12) will visit the Arizona Cardinals next Sunday.