He passed the medical, although it was said he was a stone overweight.
The 23-year-old England international put pen to paper for an undisclosed fee understood to be in the region of £12million after travelling to Tyneside for a medical and talks on Tuesday.
Shelvey is the club's second new signing in 24 hours following the arrival of Henri Saivet from Bordeaux, also on a long-term deal and for a fee understood to amount to around £5million.
He said: "I'm very excited to be here. I'm so glad that it's finally done. I drove up through the night to be here, so it's been a manic 24 hours but it's all been worth it to come here and play for this great club."
He made his last appearance for the Swans, who are just two points better off than the relegation-threatened Magpies, in Sunday's 3-2 FA Cup third-round defeat at League Two Oxford, after which he became involved in a row with a disgruntled fan as he left the pitch.
Newcastle head coach Steve McClaren has been desperate to add players who know the Barclays Premier League to his squad after seeing summer signings Aleksandar Mitrovic and Florian Thauvin struggle to establish themselves in English football.
McClaren said: "I'm delighted to welcome Jonjo to Newcastle United. He has great experience for a young English central midfielder and he is a current England international, so I'm certain he will be a great addition to the squad.
"He is a player we have admired for some time and we're very pleased that we've now been able to bring him here."