Bayern cling on to win cup and complete treble
The all-conquering Bavarians, who had previously landed the Bundesliga and Champions League titles, led 3-0 before Stuttgart struck twice in a 10-minute spell and almost grabbed a stoppage-time equaliser.
Bayern, runners-up in all three competitions last season, were cruising when a harsh penalty converted by Thomas Muller and two Mario Gomez goals against his old club put them 3-0 up inside 61 minutes.
Stuttgart, hammered 6-1 by the Bavarians in the Bundesliga, then gave the European champions a real scare as Martin Harnik pulled two goals back and Bayern goalkeeper Manuel Neuer stopped Serdar Tasci's header on the line with almost the last touch of the game.
Bayern hung on to complete a memorable season and give departing coach Jupp Heynckes the best possible send-off as he ended his third stint in charge to make way for former Barcelona supremo Pep Guardiola.
Heynckes has left the Spaniard with a tough act to follow as he has managed to rotate the team and keep Bayern's wealth of international players happy even when they have been dispatched to the bench.
They became the seventh team to win their own league, cup and European Cup in the same season, following Inter Milan (2010), Barcelona (2009), Manchester United (1999), PSV Eindhoven (1988), Ajax Amsterdam (1972) and Celtic (1967).
It was Bayern's ninth league and cup double and the 15th time they have won the cup competition.
They set a plethora of records this season, winning the Bundesliga with an unprecedented 91 points and only one defeat.
Bayern also set records for the number of wins (29), the number of away wins (13), fewest goals conceded (18) and best goal difference (an astonishing plus-80).
In all they played 54 games, including the season-opening German Supercup match, and lost only three.
"It's unbelievable what the team has achieved this season," captain Philipp Lahm told ARD television.
"Heynckes has got the recognition he deserves," said sporting director Matthias Sammer. "He has distinguished himself by his clarity, planning, attention to detail, diligence and wisdom."
Just as in last week's 2-1 Champions League final win over Borussia Dortmund, Neuer prevented Bayern falling behind with some outstanding stops.
Stuttgart nearly took an early lead when Alexandru Maxim hooked Ibrahima Traore's swerving cross just wide of the post from 12 metres.
Maxim then floated over a free-kick and it was diverted towards his own goal by Bastian Schweinsteiger. Neuer blocked at close range, then dived at the feet of Georg Niedermeier as he tried to scramble the ball in.
Bayern were awarded a soft penalty when Lahm burst into the box and his legs crumpled as he went shoulder to shoulder with Traore, Mueler burying the spot-kick to open the scoring in the 37th minute.
They went two ahead in the 48th minute when Lahm's low cross was scrambled into an empty net by Gomez.
Gomez's second goal in the 61st minute was far more convincing