RB Leipzig scored in added time through Willi Orban to snatch a 1-1 draw at Arminia Bielefeld on Saturday and secure their Champions League berth with a fourth-place finish in the Bundesliga as their opponents were relegated.
Leipzig needed at least a point to make sure of a top-four place, but their job was made easier after Freiburg lost 2-1 at Bayer Leverkusen to fall short on the last matchday.
Janni Serra scored for Arminia in the 70th minute, but Orban headed in from a free kick to earn his side a point.
Union Berlin completed their sensational season with a 3-2 over VfL Bochum to finish fifth on 57 points, one behind Leipzig, and secure a spot in the Europa League.
Cologne conceded a stoppage-time goal at VfB Stuttgart to go 2-1 down but still end up in the Europa Conference League. Stuttgart's last-gasp goal kept them up for another season, sending Hertha Berlin into a relegation playoff.
Arminia remained in 17th and will join Greuther Fuerth in the second division.