LONDON (AP) -- All that is left to decide on the final day of the Premier League is whether Liverpool or Chelsea takes the final Champions League place.
And it is advantage Liverpool -- by two points and a vastly superior goal difference.
Juergen Klopp has friend David Wagner to thank for Liverpool only requiring a draw against Brighton to hold onto a top-four finish on Sunday when Chelsea is at Newcastle.
Wagner's Huddersfield held dethroned champion Chelsea to a 1-1 draw on Wednesday, ensuring the northern English team will have a second-ever season in the Premier League.
"This is the least you can do as a friend," Wagner said of Klopp, "to do him a favor."
Since Brighton and Newcastle were already safe, all three promoted teams this season have avoided the drop.
"It's a bigger achievement than getting promoted," Wagner said. "We were predicted as a team to get relegated."
Newcastle's 1-0 loss at Tottenham allowed the north London club to complete its season at its temporary Wembley home by securing a place in the top four.
Harry Kane curled a shot into the top corner to guarantee third-place Tottenham will open its new stadium in the Champions League for a third consecutive season.
The three teams going down are Stoke, West Bromwich Albion and, almost certainly, Swansea. Although the south Wales club can still catch Southampton on points on the final day, its goal difference is inferior by nine.
Sunday will be the final time Arsene Wenger manages Arsenal after 22 years. The Frenchman's penultimate game ended in a 3-1 loss at Leicester on Wednesday.
On a miserable night for Chelsea, three of its Premier League records were broken by Manchester City after the title-winners beat Brighton 3-1.
City moved onto 97 points, two more than Chelsea's final total from the 2004-05 season, and 105 goals, two more than Chelsea's previous record haul from the 2009-10 season. Pep Guardiola's team also now has 31 wins, surpassing the previous record of 30 set by Chelsea last season.
The night's games started against the backdrop of more encouraging news from the hospital where the league's most successful-ever manager is being treated. Former Manchester United manager Alex Ferguson is out of intensive care after emergency surgery on Saturday on a brain hemorrhage.
As players and fans of Huddersfield, including actor Patrick Stewart, celebrated at Stamford Bridge, Chelsea players watched on gloomily.
This was Huddersfield's night, taking the lead five minutes into the second half.
Willian was disposed inside the Chelsea half and Huddersfield midfielder Aaron Mooy launched a high ball forward. Chelsea goalkeeper Willy Caballero raced off his line and collided with Laurent Depoitre, allowing the visiting forward to tap into the net.
Chelsea fortuitously equalized in the 62nd when Mathias Jorgensen's clearance cannoned off Chelsea defender Marcos Alonso's head and went back into the net.
As Chelsea scrambled to produce a winner to move level on points with Liverpool, Huddersfield goalkeeper Jonas Lossl made vital saves, including tipping Andreas Christensen's header on the post.
"This was definitely the most important save in my career, no doubt about it," the 29-year-old Lossl said.
All Yaya Toure, the 34-year-old Man City midfielder, was missing was a farewell goal against Brighton at the Etihad Stadium. On his 316th appearance since joining from Barcelona in 2010, the three-time Premier League winner was in the thick of the action throughout.
The goals -- all set up by Leroy Sane -- came from Danilo, Bernardo Silva and Fernandinho.