Schaer played in three of Switzerland's four games at the World Cup in Russia, helping the Swiss to progress from Group E – along with Brazil – before missing their last-16 defeat by Sweden through suspension.
He made 25 appearances for Deportivo in La Liga last season, having moved to the Spanish outfit from 1899 Hoffenheim a year ago.
The defender, 26, is the Magpies' fourth signing of the summer, following the arrivals of Slovakia's Martin Dubravka and South Korea's Ki Sung-yueng and the loan capture of Brazilian Kenedy.
“I'm really happy to be here,” said Schaer. “The club is a really big club for me. It has a big name and it is a brilliant chance for me.
“I'm not like a typical defender. I, of course, defend but I'm quite good with the ball. “I like to play, I want to build up the game from behind and I think that is a strength of mine. I have also scored some headers. That could also be a strength and hopefully I can use it here.”
Manager Rafa Benitez said: “I'm really pleased to welcome Fabian to Newcastle United. He is an international, did well in the World Cup and has great experience. He adds competition in this position and that is a positive for the team.”
READ MORE: Liverpool sign Switzerland winger Shaqiri