The 22-year-old former Tenerife striker, who has been linked with Tottenham, Arsenal, Manchester City and Manchester United among others, put pen to paper on Monday as head coach Steve McClaren continued his efforts to re-shape the squad.
Perez, who has scored 12 goals in 63 appearances for the club, was thrilled to have tied up his future.
He said: "It's a special day for me, a big day for me. The truth is I'm really happy here, so it's a good thing for me - and I hope it's the same for the Geordie family.
"Newcastle gave me everything and I'm really pleased to sign this new contract."
McClaren was equally happy to have ensured Perez's extended stay on Tyneside.
He said: "I am delighted that Ayoze has signed a new deal. He is a very good player with huge potential and someone we believe has a very big future at Newcastle United.
"We are building this club for the long-term and Ayoze is a very important part of that."