The 25-year-old Alvarez enjoyed a breakout season in 2012, batting .244 with a career-high 30 home runs and 85 RBIs in 149 games. His home run total was 10th best in the National League, though he also led NL third basemen in errors with 27 and finished second in the NL in strikeouts with 180.
Pittsburgh also has a $700,000 option for 2014 as part of the 2008 agreement that included a $6 million signing bonus.
Barajas, who signed with the Pirates as a free agent last winter, struggled at the plate and on defense. The 37-year-old hit just .206 with 11 homers and 31 RBI and threw out only six of 99 base stealers.
Pittsburgh also released reliever Hisanori Takahashi, who posted an 8.64 ERA in nine appearances.