Newcastle United held off a late comeback from Nottingham Forest to move back into the top five of the Premier League.