Hiroshi Kiyotake scored two goals as Nurnberg moved away from the Bundesliga drop zone with a crucial home victory over fellow strugglers Hoffenheim.
Kiyotake gave Nurnberg the lead after six minutes and although Sven Schipplock equalised in the 33rd minute, Per Nilsson pushed the hosts back ahead just before the interval and Sebastian Polter made it 3-1 in the 69th minute.
Sejad Salihovic converted from the spot to halve the deficit in the 81st minute but Kiyotake struck again in the 86th minute to give the hosts all three points.
Nurnberg collected just their second win in 11 matches to move four points clear of 16th-placed Hoffenheim.
Nurnberg took the lead after just six minutes as Kiyotake's free-kick from the left evaded everyone in the box before going past Hoffenheim keeper Koen Casteels.
The visitors nearly equalised four minutes later but Marvin Compper's attempt was just wide.
Kiyotake was close to a second goal in the 17th minute, dancing past two Hoffenheim defenders and Casteels but Compper cleared off the goal-line.
And it was to prove a crucial intervention as Hoffenheim equalised after 33 minutes when Kevin Volland crossed from the left to Schipplock, who headed home from six yards out.
Nurnberg regained the lead two minutes before the break as Nilsson headed in the rebound after Casteels deflected Timo Gebhart's free-kick off the crossbar.
It was 3-1 in the 69th minute as Compper mis-judged a back pass and Polter latched onto the loose ball, raced past Casteels and slotted home.
Hoffenheim set up a tense finale in the 81st minute as Salihovic converted from the spot after Nilsson was adjudged to have handled the ball in the area.
But Kiyotake ensured victory for Nurnberg with a superb solo effort.
The Japan international raced in from the right before striking a curling, looping ball around Casteels and in off the right post.