Daryl Janmaat and Ayoze Perez had decent chances for Newcastle in the first half, but they could not take the lead and United made them pay once they had found their form.
The Magpies only found the net in the 87th minute when Papiss Cisse scored a penalty following Phil Jones' foul on Jack Colback.
It could have been a different story had referee Michael Jones awarded the away side a spot-kick in the first half when Mata clipped Yoan Gouffran's heels.
Alan Pardew (BBC): "The referee has got a bad call very wrong.
"I think that was a penalty. I think Mata's run across the back of a player who is going to head the ball across goal.
"That's a goalscoring opportunity. It was clumsy and that was a penalty.
"We need to defend better than we did today. Today we was a little bit loose."