Leeds United leapfrogged Burnley with a 2-1 victory at Brentford to earn Premier League safety, with the Clarets losing 2-1 at home to Newcastle United.
After Joe Gelhardt had a goal disallowed for offside following a VAR review, Brentford ended the first half on top with Mathias Jensen forcing a save from Illan Meslier before Bryan Mbeumo pulled a shot wide.
However, Leeds went in front on 56 minutes when Raphinha slotted in a penalty after he was fouled by David Raya.
A Sergi Canos header restored parity with 12 minutes remaining before he was sent off for a second bookable offence.
Jack Harrison secured the victory in the fourth minute of stoppage time with a strike from the edge of the penalty area.
The Whites are the first team to avoid relegation having started the final day in the bottom three since 2011 and finish 17th with 38 points, three clear of Burnley.
Brentford end their debut Premier League season in 13th place.
Source: Premier League