PHILADELPHIA (AP) - Arizona's surge into the wild-card race hit a major bump in Philadelphia.
Carson Palmer couldn't hold on to the ball early. Tyrann Mathieu held too much late.
Arizona's barrage of turnovers and penalties were enough to end a four-game winning streak that had the Cardinals in the thick of the NFC wild-card hunt.
Nick Foles threw three touchdown passes and a tough defense at the end helped the Eagles hold on for a 24-21 victory over Arizona on Sunday.
Palmer threw for 302 yards and three TD passes, but also had two interceptions and lost a fumble for the Cardinals (7-5).
''We've got to know, if we play error free,'' Arizona coach Bruce Arians said, ''we win games like this.''
The Cardinals were a mess from the very first series. On the third play from scrimmage, Trent Cole sacked Palmer and forced a fumble that was recovered by Bennie Logan at the Cardinals 25. Foles then tossed a 6-yard TD pass to Zach Ertz for a 7-0 lead.
Palmer was intercepted on Arizona's second drive, giving him two fast turnovers after not committing any the past two games.
''You can't come into a place like this and play against a good team in front of a crowd like this and not win that battle,'' he said.
The Cardinals were already hampered playing without leading rusher Andre Ellington. Ellington injured his left knee late last week in practice, his loss a significant blow to the Arizona offense because he provides speed the team's other backs don't possess.
Without Ellington, the Cardinals rushed for only 90 yards.
''He's very unique,'' Palmer said. ''We had certain things built in for him. We had some things we really liked.''
It took some time before Arizona ran the offense it liked. Aided by another stout defensive performance, the Cardinals rallied in the fourth quarter to close within three.
Foles got away with a poor decision late in the fourth when he was intercepted by Patrick Peterson at the Philadelphia 43. But a holding penalty on Mathieu gave the Eagles a first down.
The Cardinals, trying for their first 8-4 start since 2009, forced a punt and took over at their 10 with 2:08 left. But Palmer misfired on third-and-5, and Bradley Fletcher knocked down a pass to Michael Floyd on fourth down.
''I was just trying to be a good defensive back and was trying to get a good jam on him,'' Mathieu said.
The Cardinals find themselves in one as they try and solidify their place in the wild-card race. Up next, a game against division foe St. Louis.
''We're still in it,'' Arians said. ''We learned a lot of lessons today; what playoff atmosphere is on the road and how to overcome it, how to handle it when bad things happen and when bad things happen.''
The Eagles (7-5) won their fourth straight game to remain tied with Dallas for first place in the NFC East. They're 5-1 when Foles starts.
Foles picked up where he left off in November, when he was the NFC's Player of the Month and tied an NFL record with seven TDs in a game. Foles finished 21 of 34 for 237 yards against a defense that came in ranked eighth in the league.
Foles set a team record for most passes without an interception (233), breaking Michael Vick's mark of 224 set in 2010. He also moved within one TD pass of tying Peyton Manning's record of 20 TD passes and zero interceptions to start a season.
Down 24-7 after Foles threw a 24-yard TD pass to Ertz on the first series in the third quarter, the Cardinals rallied. Palmer tossed a 23-yard TD pass to Floyd to cut it to 24-14 on the next series. Floyd had five catches for 99 yards.
A holding penalty on Kurt Coleman negated DeSean Jackson's 54-yard punt return for a score early in the fourth.
Palmer then threw a 3-yard TD pass to Jim Dray to get the Cardinals within a field goal at 24-21 with 4:45 left.
Foles drove the Eagles 78 yards late in the second quarter, tossing a 1-yard TD pass to Brent Celek to make it 17-7 before halftime. A 28-yard pass interference penalty on Jerraud Powers put the ball at the 1.
Palmer connected with Larry Fitzgerald on a 43-yard TD pass to tie it at 7 midway through the second quarter.
Fitzgerald made the catch over the middle on a third-and-20 pass, two defenders collided into each other and the seven-time Pro Bowl receiver ran untouched into the end zone.
''It's just a minor setback,'' Fitzgerald said. ''We'd love to have this game, but it's not the end of the world for us.''
NOTES: Cardinals are 0-8 when seeking their fifth win in a row since 1977. ... In Arizona's four-game winning streak, Palmer has eight touchdown passes and only two interceptions.
AP NFL website: www.pro32.ap.org