Vedad Ibisevic gave Stuttgart the lead in the ninth minute and the 17-year-old Werner made it 2-0 just 83 seconds later.
Freiburg registered their goal in the 78th minute through Mike Hanke but Werner struck again in the 82nd minute.
Stuttgart, who lost to Freiburg in the second round of the DFB-Pokal in late September, halted a four-game winless run to move up to eighth place.
Freiburg failed to build upon winning their first league match of the season last weekend and remain without a victory at home.
Mainz piled the pressure on local rivals Eintracht Frankfurt with a last-gasp 1-0 win at the Coface Arena.
Eric-Maxim Choupo-Moting scored in the 88th minute of the Rhine-Main derby, earning Thomas Tuchel's men only their second win in their past nine league games and extending Frankfurt's winless run to seven.
It meant a nervous wait for Frankfurt, who could have dropped into the bottom three should Freiburg have won but instead they remain one place and two points ahead.