The deal comes only a few days after owner Jim Crane went on the record saying his front office was working on acquiring a top starting pitcher.
Talks between the teams seemed to have cooled in the month since the winter meetings. He is scheduled to become a free agent after the 2019 season. It wasn't immediately clear what Pittsburgh will receive in return.
Where it leaves the Yankees remains to be seen.
The Yankees' rotation now includes Luis Severino, Masahiro Tanaka, Sonny Gray and CC Sabathia.
The Yankees were also rumored to be in on Cole, but ultimately came second in the sweepstakes for the 27-year-old.
Pittsburgh selected Cole with the first overall pick in the 2011 draft.
Cole has pitched for the Pirates since 2013.
The Yankees miss out on righthander Gerrit Cole. He helped lead the Pirates to the postseason, but he coughed up four earned runs in five innings during a loss against the Chicago Cubs in the National League Wild Card Game.