PHILADELPHIA (AP) After building a 27-point lead, the Philadelphia Eagles needed a defensive stand to win the game.
''We have to learn how to finish better,'' Foles said. ''As a team, we're not there yet.''
The Rams had a chance for the win when they got the ball at their 7 with 1:47 left. Davis threw a 43-yard pass to Quick on first down, but Philadelphia's defense finally made a stop. Davis was under pressure when he threw an incomplete pass on fourth-and-13.
''We were rolling. I had no doubts in my mind we were going to win,'' Davis said of the final drive.
Davis, who began the year as the No. 3 quarterback, finished with 375 yards passing and three TDs in his first game since being elevated to starter for the rest of the season.
The Eagles (4-1) rebounded from a tough loss at San Francisco with a strong all-around performance until the offense stumbled and defense nearly collapsed in the fourth quarter. Chris Maragos returned a blocked punt for a touchdown, Cedric Thornton recovered a fumble for a score and nearly took another one the distance.
''Tough 4-1, soft 4-1, it doesn't matter,'' Eagles coach Chip Kelly said. ''You're 4-1 and you go back to work Tuesday.''
The Eagles have scored seven TDs on special teams and defense, including five in the past two games. Meanwhile, Kelly's high-flying, up-tempo offense isn't clicking the way it did last year - but the team is winning.
''Turnovers equal victories,'' Thornton said. ''We try to get our hands on the ball and we've been capitalizing on it.''
Foles tossed a 9-yard pass to Riley Cooper with 30 seconds left in the second quarter, ending a drought of 18 drives and 97:04 without an offensive TD. He connected with Jeremy Maclin on a 24-yard pass for a 34-7 lead in the third.
On St. Louis' first play of the second half, Trent Cole sacked Davis and forced a fumble that Thornton recovered in the end zone for a 27-7 lead. Later in the third quarter, Thornton picked up a fumble after Brandon Graham stripped Zac Stacy and rumbled 40 yards before he was dragged down from behind. That set up Foles' second TD pass.
LeSean McCoy, an All-Pro last year, had 81 yards rushing. He had 39 yards on 29 carries in the previous two games.
But Davis couldn't complete a remarkable comeback.
''This team likes to play. They always believe they have a chance,'' Rams coach Jeff Fisher said.
The Eagles took a 7-0 lead when James Casey blocked a punt, Maragos scooped it up and ran 10 yards for a touchdown. It was the second straight game the Eagles blocked a punt for a score and the first time in team history they've had a TD on special teams in three consecutive games. Chris Polk returned a kickoff 102 yards in a win over Washington in Week 3.
The Eagles' first two drives stalled inside the 10. Cody Parkey kicked field goals of 26 and 27 yards.
After E.J. Gaines intercepted Foles' deep pass at the Rams 16, Davis led them on a long drive. He scrambled backward, avoided a pass rush and threw from the 25, an 8-yard TD pass to Quick in the back of the end zone to cut it to 13-7.
NOTES: Fisher, who began his NFL coaching career as an assistant under Buddy Ryan in Philadelphia in 1986, fell to 4-1 vs. the Eagles. ... The Ravens in 2002 were the last team to score a TD on a blocked punt two straight games before Eagles did it. ... Stacy left the game with a calf injury. ... Eagles LB DeMeco Ryans (right groin) and RB/KR Chris Polk (hamstring) didn't return.
AP NFL websites: www.pro32.ap.org and www.twitter.com/AP-NFL
Follow Rob Maaddi on Twitter: https://twitter.com/AP-RobMaaddi