Steve Smith Sr caught a 34-yard pass from Joe Flacco at the end of the second quarter to give the Ravens a six-point advantage going in at half-time.
Kenneth Dixon scored his first rushing touchdown and the hosts could have sealed the win soon after, but Flacco threw a pick to Jordan Hicks on the Philadelphia four-yard line.
Carson Wentz bundled his way into the end zone with seconds remaining, however, the two-point conversion, which would have won the game, was incomplete and the Ravens managed to survive to move to 8-6.
Aiken strikes early in first quarter
Baltimore's destiny is still in their own hands, but they need to beat the Pittsburgh Steelers on Christmas Day to stand a chance of going to the playoffs.
On the third play of the game, Zach Orr picked off Wentz and that allowed the Ravens to take advantage as Flacco threw to Kamar Aiken for a five-yard touchdown reception.
Caleb Sturgis was good from 45-yards before his opposing number, Justin Tucker, kicked a 53-yard field goal to close out the first quarter.
Mathews puts the Eagles ahead
Philadelphia went ahead after taking full advantage of a short field after Nigel Bradham stripped the ball out of Flacco's arms and Fletcher Cox recovered the ball.
This allowed Ryan Mathews to break through the middle and into the end zone to put the visitors ahead by one after the running-back leapt over the line of scrimmage on the two-point conversion.
Tucker and Sturgis exchanged field goals once more before the Ravens struck a decisive blow just before half-time. Flacco found Smith Sr down the sideline and into the end zone for a 34-yard reception.
Dixon scores first rushing touchdown
Terrance West picked up a 41-yard gain with a bursting run on the first play after half-time, however, a scoreless third quarter followed, in which the Eagles ended the quarter on the Ravens' nine-yard line.
Baltimore's defense stood strong and held Philadelphia out once more, Sturgis kicked another field goal, but eight plays and 69-yards after the restart, the hosts took their lead into double figures.
Flacco tossed the ball off to Dixon, who rushed 16-yards to the outside and broke his way through into the end zone.
Eagles miss two-point conversion late in game
Harbaugh's side were handed a chance to close out the game when the Eagles failed to get the yardage on fourth down, however, they couldn't make the most of it.
Flacco found Mike Wallace for a 54-yard catch and run before the quarterback threw an interception to Hicks, which handed Philadelphia a chance to drive up the field.
Sturgis kicked a field goal before the hosts were forced to punt away with 1:50 left on the clock. Wentz found Zach Ertz for a 24-yard gain before the rookie quarterback rushed into the end zone for a four-yard touchdown.
Four seconds remained on the clock when the Eagles decided to go for the two-point conversion, however, Baltimore made a game-winning stop as they broke up Wentz's pass to hold on for a narrow victory.