Newcastle substitute Ayoze Perez scored a dramatic injury-time winner as the Magpies came from behind to snatch a shock 2-1 victory against Tottenham.