NEW YORK — The New York Yankees and prized Japanese pitcher Masahiro Tanaka agreed Wednesday to a $155 million, seven-year contract.

In addition to the deal with the 25-year-old right-hander, the Yankees must pay a $20 million fee to his Japanese team, the Rakuten Golden Eagles.

Masahiro Tanaka (AP Photo)

After missing the playoffs for just the second time in 19 years, the Yankees went on a free-agent spending spree this offseason, also adding catcher Brian McCann and outfielders Jacoby Ellsbury and Carlos Beltran. The four big deals totaled $438 million.

"We're going to do what we've got to do to win," Yankees co-chairman Hank Steinbrenner told The Associated Press in a telephone interview. "Anybody that questioned our commitment to winning is going to have to question themselves."

Big league teams had until Friday to reach an agreement with Tanaka, who was 24-0 with a 1.27 ERA last year as the Golden Eagles won the Japan Series title.

His agreement, first reported by Fox, calls for $22 million in each of the first six seasons and $23 million in 2020, and it allows the pitcher to terminate the deal after the 2017 season and become a free agent.

Tanaka receives the highest contract for an international free agent and the fifth-largest deal for a pitcher, trailing only the seven-years deals of the Los Angeles Dodgers' Clayton Kershaw ($215 million), Detroit's Justin Verlander ($180 million), Seattle's Felix Hernandez ($175 million) and CC Sabathia ($161 million under his original agreement with New York).

Tanaka replaces the retired Andy Pettitte in the rotation, joining Sabathia, Hiroki Kuroda and Ivan Nova. David Phelps, Adam Warren, Michael Pineda and Vidal Nuno are in the mix for the No. 5 slot.

"We had to make sure we had enough pitching to go together with our new lineup," Steinbrenner said.

New York had great success in the Japanese market when it signed outfielder Hideki Matsui, a star from 2003-09 who was the World Series MVP in his final season in pinstripes. But the Yankees had failures with Hideki Irabu and Kei Igawa, pitchers who failed to file up to their potential.

Tanaka's deal pushes the Yankees' payroll for purposes of the luxury tax over $203 million for 20 players with agreements. Barring trades, there is little chance New York will get under the $189 million tax threshold.

Yankees managing general partner Hal Steinbrenner had been saying for two years that getting below the tax threshold in 2014 was a goal but wouldn't get in the way of fielding a contending team. In addition to losing tens of millions of dollars in revenue sharing annually, the Yankees have paid $252.7 million in luxury tax over the last 11 years.

"There has been criticism of myself and my brother the last couple years that, gee, if our dad was still in charge, we'd be spending this and spending that and doing whatever it takes to win," Hank Steinbrenner said, referring to late Yankees owner George Steinbrenner.

"He didn't have revenue sharing, at least for most of his time," Hank Steinbrenner added. "That's what these people in the sports media don't seem to get. If it wasn't for revenue sharing, we'd have a payroll of $300 million a year if we wanted to. So we're doing this despite having to pay all that revenue sharing."

Tanaka was the first player available under the new agreement between Major League Baseball and Nippon Professional Baseball, which caps posting fees at $20 million and allows multiple big league teams to negotiate. Under the previous system, in place from December 1998 through last offseason, there was no limit on the bid for negotiating rights and only the team with the top bid could try to sign the player.

Under that system, Boston obtained pitcher Daisuke Matsuzaka from the Seibu Lions before the 2007 season for $51,111,111.11 and agreed to a $52 million, six-year contract. Texas got pitcher Yu Darvish from the Hokkaido Nippon Ham Fighters before the 2012 season for $51,703,411 and gave him a $56 million, six-year deal.