Stuttgart will play European football next season after they reached the German Cup final by beating 2-1 Freiburg at home in the semi-finals.
Arthur Boka gave Stuttgart the lead after nine minutes with Jan Rosenthal equalising for Freiburg in the 14th minute.
However, Martin Harnik gave Stuttgart the win with his goal in the 29th minute.
Stuttgart's victory sets up a date with champions Bayern Munich in the German Cup final in Berlin on June 1.
Stuttgart have won three German Cup titles - the last dating back to 1997 - and with Bayern having already qualified for Europe, they will play on the continent next year win or lose.
Stuttgart, who are 12th in the Bundesliga with five rounds left, will automatically qualify for at least the qualification round of the Europa League. They will reach the group stage if they beat Bayern in the final.
The home side started with a series of chances straight away, but Harnik shot wide in the third minute, and had other shots stopped by Freiburg keeper Oliver Baumann.
The hosts did grab the lead in the ninth minute, though, as Ibrahima Traore collected a pass down the left wing and squared it into the middle where Boka hit home from 13 yards out.
Freiburg, who were making their first appearance in the German Cup semis, levelled just five minutes later with Max Kruse feeding a long ball to Rosenthal, who beat Stuttgart keeper Sven Ulreich with a low shot into the left corner.
Stuttgart reclaimed the lead in the 29th minute as Christian Gentner crossed from the left side to Harnik, whose header went off the lower half of the crossbar and in.
The hosts continued to march forward with chances but Gentner's blast went just wide right in the 50th minute and Freiburg defender Pavel Krmas saved Vedad Ibisevic's shot on the goal-line three minutes later.
Freiburg were close to equalising in the 70th minute but Ulreich did a good job fending away Kruse's deflected shot, while at the other end Baumann kept Freiburg in the match by stopping Harnik in a one-on-one situation in the 86th minute.