The 29-year-old joins the Magpies for an undisclosed fee following Swansea's relegation from the Premier League last season, putting pen to paper on a deal which will keep him at St James' Park until 2020.
The Argentina international, who will wear the number 18 shirt for his new club, previously worked with Newcastle manager Rafael Benitez at Napoli before joining Swansea, where he made more than 100 Premier League appearances.
"It was a long day but I'm really happy to be here," Fernandez told the club's official website.
"It's a new challenge in my life and I'm very excited to meet all the players and staff here."
Benitez added: "I know Federico well from our time together at Napoli and it was an easy decision to bring him here. He is experienced, a very good professional and he will add competition in defence."
Fernandez becomes Newcastle's seventh signing of the summer and could make his debut for the Magpies against Tottenham Hotspur on Saturday.