TAMPA, Fla. - Nick Foles told Andy Reid and Marty Mornhinweg the play he wanted. The rookie quarterback, making just his fourth NFL start, had driven the Eagles 1 yard away from a victory over the Tampa Bay Buccaneers with two seconds left.

The Buccaneers called a timeout, and Foles met with the coaches. They discussed plays designed for that situation.

"I want that one," Foles said, sharing his confidence in a rollout that put Jeremy Maclin in single coverage along the sideline.

"Let's do it," Reid said. Mornhinweg, the offensive coordinator, slapped Foles' hand, trusting his 23-year-old quarterback.

Foles came through. He rolled to his right and found Maclin for the winning touchdown Sunday in a 23-21 victory at Raymond James Stadium that ended an eight-game losing streak.

"He called it, he wanted it, he executed it," Reid said.

It was the Eagles' first win since Sept. 30, snapping a demoralizing slump that sullied what will likely be Reid's final season in Philadelphia. The most important part of the rest of the season is Foles' development, and he improved for the fourth straight start on Sunday. The next test comes Thursday at home against the Bengals.

Foles finished 32 of 51 for 381 yards and two touchdowns. He also rushed for 27 yards and a score. On the final two drives of the game, when the Eagles recovered from a 21-10 deficit, Foles threw for 132 yards and two touchdowns.

"They're special; you try to get in the zone, execute the offense, and not do much," Foles said of the winning drive. "It's always a fun feeling when you win on a two-minute drive."

The closing heroics were required because of miscues earlier in the game. After both teams punted on their first five drives, the Eagles scored 10 points in the second quarter - and could have totaled 13 if not for a false start on a field goal.

The momentum swung when Damaris Johnson muffed a punt that the Buccaneers recovered on the Eagles 5-yard line early in the third quarter. Tampa Bay scored three plays later and dissected the Eagles' defense for two touchdowns in the fourth quarter. The Bucs converted five third-down conversions on their three scoring drives and took a 21-10 lead with 7 minutes, 21 seconds left.

In past weeks, the Eagles would have unraveled. On Sunday, they rallied behind Foles.

"He showed great intestinal fortitude and desire and all the intangible things you look for," Reid said.

Strong performances from Foles' receivers certainly helped. Maclin had nine catches for 104 yards, and Jason Avant grabbed seven passes for 133 yards. The Eagles needed a strong passing game because Tampa Bay's No. 1-ranked rushing defense stuffed Bryce Brown, who finished with 6 yards on 12 carries.

After Foles connected with Clay Harbor for an 11-yard touchdown with 3:55 remaining, the Eagles forced Tampa Bay to punt after running just 54 seconds off the clock. That critical stop put Foles in a position to earn his first win.

"The key in the two-minute drill is to play fast, execute, be smart with the football, and no sacks," Foles said.

Foles took one sack after the Eagles regained possession, but completed a 23-yard pass to Maclin and a 22-yarder to Avant, all the way to the Buccaneers 1-yard line.

Foles spiked the ball with two seconds left. Tampa Bay called a timeout upon seeing the Eagles' formation. Foles huddled with Reid and Mornhinweg and discussed options, changing the play from the one called before the timeout.

Foles said he preferred the rollout because it changes the throwing lanes. If he simply dropped back in the pocket, a defender could undercut the pass. When he spoke up, Mornhinweg was initially surprised, but the coaches handed Foles the reins.

"Any time a quarterback wants something specific, allow him to do it, take ownership of it, and he sure did," Mornhinweg said.

Maclin said he saw how Buccaneers cornerback Leonard Johnson lined up against him and felt confident in the matchup. Foles threw the pass down and away, just where Maclin needed it.

After the sliding catch, Maclin sprinted halfway down the field in glee. After the game, the locker room was flooded with euphoria. It was the Eagles' first win in more than two months, and they won it because their rookie quarterback accelerated his development and showed the confidence and the ability to perform in the clutch.

"I think he can be special," Maclin said. "His intangibles are off the chart."