LONDON (AP) When the big lead was finally wiped out, Blake Bortles got his offense going for one last drive.

Got it going right into the end zone.

It was the defense that gave the Jacksonville Jaguars a big lead over the Buffalo Bills at Wembley Stadium, but it was Bortles that put the final touch on the 34-31 victory by completing a 31-yard touchdown pass to Allen Hurns with 2:16 remaining.

More from FoxSports

''The offensive line, they did a great job as far as just giving Blake a lot of time,'' Hurns said of the winning play. ''Blake does an awesome job of just keeping plays alive.''

The Jaguars (2-5) won their first game in London after losing in each of the past two seasons at Wembley, the home of England's national soccer team. The Bills (3-4) were playing in the British capital for the first time.

It was also the first time the game was streamed live around the world on Yahoo's website.

The Jaguars built up a 27-3 lead, mainly by taking advantage of another inconsistent performance from backup Bills quarterback EJ Manuel.

On third-and-9 early in the second quarter, Aaron Colvin forced a fumble from Manuel and Chris Clemons grabbed the loose ball and ran 6 yards into the end zone. After the kickoff and a touchback, Manuel was again in the pocket but his pass was picked off by Telvin Smith, who ran it in from the 26.

And the defense wasn't done yet. On the fourth play of the next drive, Manuel was again picked off, this time by Paul Posluszny.

''Just bad football,'' said Manuel, who finished with 298 yards on 24 of 42 passing with two touchdowns and two interceptions.

Manuel, however, led the comeback attempt and safety Corey Graham nearly capped it off by returning an interception 44 yards for a touchdown and 31-27 Bills lead.

That's when Bortles came up with the goods.

''To be able to stay calm and to have a big lead and give it up and be able to come back and score to win the game is huge,'' said Bortles, who was 13 of 29 for 182 yards, two touchdowns and one interception.

Here are some things we learned:

BILLS NEED A BREAK: The Bills have been struggling with injuries, and next week's bye is probably just what the doctor would have ordered.

Besides missing quarterback Tyrod Taylor and defensive tackle Kyle Williams, the Bills have several other key players out, including running back Karlos Williams, tackle Seantrel Henderson and wide receivers Percy Harvin and Sammy Watkins.

''Quite honestly, I don't know if I've ever been on a team that needed a bye week worse than we do,'' Bills coach Rex Ryan said. ''We got to get some guys back.''

JAGUARS CAN RALLY: Jaguars coach Gus Bradley looked up at the scoreboard in the second quarter and didn't like what he saw: Bills 27, Jaguars 3.

''I felt like, ''Oh, here we go, man,''' Bradley said. ''`We've got to really fight now.'''

Despite the team's poor record this year, Bradley seems to have them looking on the bright side. And it showed.

JAGUARS AT HOME: The Jaguars seem to finally be feeling at home in London after two losses over the past two years.

On Friday, the team extended its contract to play every season at Wembley through 2020. That will make it eight straight years of playing games at the iconic London venue that hosted the 1966 World Cup final.

MANUEL STILL INCONSISTENT: EJ Manuel started for the second straight game, and for the second straight loss.

And it was Manuel's early mistakes that gave the Jaguars a big lead in the second quarter.

But Ryan is sticking by him, at least until Taylor is healthy enough to return.

''Wasn't just EJ. We give up a 33-yard touchdown down, 28-yard touchdown run,'' Ryan said. ''It's just crazy. Anything that could go wrong did go wrong. We were still able to overcome it to grab the lead. It's unfortunate.''

NFL AT WEMBLEY: Sunday's game drew 84,021 fans - the second-highest NFL attendance at Wembley since the the league started playing regular-season games in the British capital.

It was only the third time in 13 games dating back to 2007 that the crowd eclipsed the 84,000 mark.

The highest attendance came in 2009 when 84,254 watched the New England Patriots beat the Tampa Bay Buccaneers 35-7. The Patriots also drew the third highest number when 84,004 saw them beat the St. Louis Rams 45-7 in 2012.

---

AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL