A time trial specialist, who is the current and three-time Spanish national champion and was also European champion in 2016, will join Sky after six years at Movistar.
During that time, Castroviejo has helped power Movistar to two team time trial victories at the Vuelta a España, and was part of the team that helped Nairo Quintana to victories in the 2014 Giro d'Italia and the 2016 Vuelta a España.
Speaking about the deal, the 30-year-old said that he was looking forward to moving on to the next stage in his career.
"Everybody knows the strength in the team, and how important the spirit between the riders is to the team’s success," Castroviejo said. "I’m really looking forward to being part of that, bringing my own experience and learning new things."
"I have been part of Grand Tour winning teams in the past and I want to do that again in the future. I’m happy to be taking this next step with Team Sky."
Team Sky are likely to use Castroviejo as a valuable domestique in the Grand Tours, with coach Xabi Artexte also hinting that he could be given a chance to ride for himself in shorter stage races.
"He’s one of the best time triallists in the world and in the last few years he’s been right up there in the top three to 10 guys at the worlds and the Olympics," Artexte said.
"He can win time trials and he can perform well in one-week stage races. He could also be one of the best domestique riders in the world and he can contribute a lot for this team.
"He’s always calm under pressure, and knows what to do and when to do it. He knows how to win the big races. He’s got experience which can be a real benefit and he can bring some good ideas to the team. He will be a really good rider for us".
Thank you for reading 20 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1