Marco Reus gave Dortmund the lead after three minutes and Jakub Blaszczykowski doubled the advantage in the ninth minute from the penalty spot. Stefan Reinartz scored a brace in the 58th and 62nd minutes to equalise only to see Robert Lewandowski make it 3-2 seconds later.
Blaszczykowski saw his second penalty attempt saved in the 70th minute but Dortmund held on for the victory, their fourth in a row as they continue to trail Bayern Munich by 12 points.
Nuremberg claimed their first victory under new coach Michael Wiesinger at the expense of Borussia Monchengladbach to move further clear of the relegation zone.
Timmy Simons gave the hosts the lead after four minutes from a penalty and Tomas Pekhart made it 2-0 in the 30th minute.
Patrick Herrmann replied for Gladbach after 58 minutes.
Sunday's Bundesliga Results