SAN DIEGO -- The Chicago White Sox have pulled off a major shake-up to their pitching staff, adding former New York Yankees closer David Robertson via free agency to go with a trade for starter Jeff Samardzija.

Robertson agreed to a four-year deal with the White Sox that is worth $46 million, a source confirmed to ESPN.com's Jerry Crasnick. The club's bullpen was among the worst in the majors last season, plagued by injuries and struggles.

The right-hander went 4-5 with 39 saves and a 3.08 ERA after taking over the closer role in New York last year from Mariano Rivera. The 29-year-old has a 2.81 ERA over seven seasons.

He will take over at closer for a White Sox team that hasn't been set in that spot since Addison Reed was traded to the Arizona Diamondbacks last offseason.

Robertson was an All-Star in 2011 and won a World Series with New York in 2009. He was paid $5.215 million in 2014. The Yankees made a one-year qualifying offer of $15.3 million to Robertson for 2015, ensuring them draft pick compensation if he signs with another team.

Sources told ESPN's Buster Olney that the Yankees never made an offer to Robertson after determining they would rather sign left-hander Andrew Miller and get the draft pick compensation in return.

Because the White Sox had among the top 10 initial picks in next year's amateur draft, they lose a second-round selection in June rather than their first-round choice, which is eighth overall. The Yankees receive an extra pick between the first and second rounds.

The White Sox had a 4.28 ERA from their bullpen last season, 28th in the majors and better than only the Colorado Rockies and the Houston Astros. The club's combined 36 saves were better than just five other major league teams.

The Samardzija trade with the Oakland Athletics was officially announced Tuesday.

White Sox outfielder Adam Eaton took to Twitter to express his excitement over the team's acquisitions.

Information from The Associated Press was used in this report.