Mujica had 37 saves and a career-best 2.78 ERA for St. Louis in 2013 and was selected an All-Star for the first time. But he lost his job as closer with a series of bad outings in September and pitched only two innings in the Cardinals' playoff run, which ended with a six-game World Series loss to Boston.
Mujica gives the Red Sox some protection if closer Koji Uehara, who turns 39 in April, cannot repeat his 2013 performance next season.
In an eight-year career, the 29-year-old Venezuelan has a 19-19 record with 41 saves and a 3.75 ERA.
The deal, agreed to Thursday and announced Saturday, calls for salaries of $4.75 million a season. He can earn $1 million annually in performance based on games finished: $125,000 for 20 and each additional five through 55.