The Yankees wanted Martin to return, but never made an offer; their priority has been in retaining pitchers and they knew what type of contract the catcher wanted, sources said.
Yankees general manager Brian Cashman already has re-signed starting pitchers Hiroki Kuroda and Andy Pettitte and has agreed to a $10 million deal, plus incentives, with closer Mariano Rivera, sources said.
It is believed the Yankees eventually would have offered Martin two years, but may not have matched the yearly average the Pirates gave him.
Martin made $7.5 million with the Yankees last year.
"I want to thank the @yankees organization and fans for treating me with class and respect... I will truly miss the city and people of NY," Martin tweeted Thursday night.
It is unclear where the Yankees will turn for catching now. The two top remaining free agent catchers on the market are Mike Napoli and A.J. Pierzynski. The Yankees are not in on Napoli, and a source indicated that Pierzynski is unlikely to be the team's next move.
Stewart, 30, played very well behind Martin, but is considered a backup. In 55 games, Stewart hit .241 with a homer and 13 RBIs. He is a strong defensive catcher.
Cervelli, a fan favorite, only played in three major-league games this past season.
Romine, considered a top Yankees prospect, was limited to just 31 games this past season because of a bad back.
Gary Sanchez, 19, is thought to have even more potential than Romine, but he never has played above A-ball and is not close to being considered for the big-league team.
Fox Sports first reported the deal with Martin and the Pirates was completed.
The Yankees liked Martin a lot, and his first choice was believed to be New York.
Martin, 29, hit just .211 last year, but manager Joe Girardi complimented him for his toughness. In the past, Cashman has compared Martin to Thurman Munson.
Martin gives the Pirates needed stability at catcher, where veteran Rod Barajas struggled at the plate and behind it. The Pirates threw out just 12 percent (19 of 154) basestealers last season, the worst percentage in baseball.
The signing reunites Martin with former teammate A.J. Burnett. The two played together with the Yankees in 2011.
The Pirates were in need of an experienced backstop after declining the club option on Rod Barajas, who struggled in his one season in Pittsburgh. Barajas hit .206 with 11 homers in 104 games and struggled defensively, throwing out just 6 percent (6 of 99) potential basestealers.
Backup Mike McKenry fared better but neither have Martin's resume. Martin threw out 25 percent (20 of 83) basestealers last season and committed just six errors in 128 games at catcher, the same total Barajas had in 24 fewer appearances.
The signing is the latest dip into deeper pockets by Pittsburgh, who went 79-83 in 2012, tied for the franchise's best record in the last 20 years. The season was marred by a late fade in which the Pirates fell from playoff contention, but the team opted not to make any major changes to the front office and instead focus on upgrading several spots, with catcher being among the top priorities.
Information from ESPN The Magazine's Buster Olney and The Associated Press was used in this report.