The Scotland international was a free agent after leaving Bournemouth at the start of July, as he opted to not sign a short-term deal with the Cherries and did not see out the remainder of the extended Premier League season with the club.
Speaking to Newcastle's official website after the club announced the news, Fraser said: "I'm absolutely buzzing for it - I came down to see the place the other day and it was all just good things; the manager, the place, the fans, the messages I've been getting.
"It was just a no-brainer, really, to play in such a big stadium with such passionate fans, and being back up in the north again is big as well.
"So I'm really looking forward to it and I just cant wait to show everyone what I can do, help the team and help us get back to where we belong."
The winger is Newcastle's second signing in the space of five hours following the addition of fellow former Bournemouth man Callum Wilson, who has also signed a long-term deal with the club.
Following his departure from Bournemouth, Fraser was considered one of the potential bargains of the summer, and Newcastle manager Steve Bruce was thrilled with his new addition and his ability to link up with Wilson.
"I'm delighted to bring Ryan to Newcastle United," said Bruce. "We have held off big competition to get his signature and that says a lot about what this club has to offer.
"His ability and his contributions on the pitch speak for themselves and I'm looking forward to seeing him getting to work in a Newcastle shirt.
"He has wonderful chemistry on the pitch with Callum Wilson, which excites me, and I hope it excites our supporters ahead of the new season."