Werder Bremen have earned themselves a Bundesliga relegation lifeline thanks to a stunning first home win in almost 10 months by scoring six against Cologne.
Gladbach prevailed 2-1 against Hertha Berlin from Jonas Hofmann to stay ahead of Bayer Leverkusen to secure a Champions League spot along with Bayern Munich, Borussia Dortmund and RB Leipzig.
Leverkusen's 1-0 win against Mainz was to no avail as they play Europa League together with Hoffenheim - whose Andrej Kramaric scored all goals in a 4-0 upset in Dortmund - and Wolfsburg.
Bremen meanwhile avoided the direct drop thanks to a 6-1 thrashing of Cologne but also needed help from Union Berlin who beat Fortuna Dusseldorf 3-0.
Bremen moved one point ahead of Dusseldorf into 16th spot and a two-legged play-off against the third-placed second-division team, possibly major northern German rivals SV Hamburg.
Dusseldorf drop straight into the second tier along with Paderborn.
Four-time champions Bremen - playing a league-record extending 1,900th Bundesliga match - were on fire with three goals within seven minutes midway through the first half against hapless Cologne from Yuya Osako, Milot Rashica and Niclas Fuellkrug.
Davy Klaassen, Osako with his second and Joshua Sergant added to the tally while Dominick Drexler got the consolation goal as Bremen got only their second home win of the season, the other on September 1 against Augsburg.
But Bremen only escaped into the play-offs because Dusseldorf failed to get a result at Union and were relegated for a sixth time in club history, one point behind Werder, thanks to goals from Anthony Ujah, Christian Gentner and Suleiman Abdullahi.
Champions Bayern Munich beat Wolfsburg 4-0 to finish on 100 goals for the season, one short of the record.
Robert Lewandowski scored a penalty for his 34th Bundesliga goal of the season as the Polish forward finished as the league top scorer for the third season in a row.
Bayern had 16 league wins from 17 games in 2020, blemished by only a goalless draw against Leipzig. Bayern can win a domestic double against Leverkusen in the cup final on July 4.
Dortmund slumped to an unexpected 4-0 defeat to Hoffenheim in an echo of the defensive problems which often plagued its bid for the title. Andrej Kramaric scored all four goals for Hoffenheim.
Timo Werner scored twice for third-placed Leipzig in his last game for the club before a transfer to Chelsea in a 2-1 win over Augsburg. Werner matched a 46-year-old league record by scoring his 17th goal of the season away from home.
Elsewhere, Schalke's 4-0 meltdown at mid-table Freiburg saw them end the season with a shocking club-record 16 games without victory; Eintracht Frankfurt beat Paderborn 3-2.
Australian Associated Press